Skip to content

Commit

Permalink
release v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
khusnetdinov committed Jan 11, 2017
1 parent bd8c824 commit da16de0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Add `sesamex` to your list of dependencies in `mix.exs`:

```elixir
def deps do
[{:sesamex, "~> 0.1.0"}]
[{:sesamex, "~> 0.2.0"}]
end
```

## Authentication in 5 minutes!

We are going to create authentication for `User` model in 5 minutes with `phoenix.new` bootstrapped application.
We are going to create authentication for `User` model in 5 minutes with `phoenix.new` bootstrapped application.

1) Create model and migration for `User`.

Expand All @@ -47,7 +47,7 @@ $ mix sesamex.gen.views User
```

5) Create predefined templates for sign_up and sign_in pages.

```elixir
$ mix sesamex.gen.templates User
```
Expand All @@ -59,10 +59,10 @@ defmodule Project.Routes do
# ...
use Sesamex.Routes
use Sesamex.Pipeline

alias Project.Repo
alias Project.User

pipeline :browser do
# ...
plug :session, [:user, User, Repo]
Expand All @@ -71,7 +71,7 @@ defmodule Project.Routes do
scope "/", Project do
# ...
authenticate :users

get "/", PageController, :index
end
# ...
Expand Down Expand Up @@ -127,7 +127,7 @@ Task get `Model` in singular form for defining controllers modules scope and gen
│ └── page_controller.ex
```

By defualt sesamex generate controllers with scope `Project.Model.ExampleController`. If you want to use custom controllers you need change settings in routes. See below.
By defualt sesamex generate controllers with scope `Project.Model.ExampleController`. If you want to use custom controllers you need change settings in routes. See below.

#### Generation predefined views modules for model scope:

Expand Down Expand Up @@ -159,10 +159,10 @@ defmodule Project.Routes do
# ...
use Sesamex.Routes
use Sesamex.Pipeline

alias Project.Repo
alias Project.User

pipeline :browser do
# ...
plug :session, [:user, User, Repo]
Expand All @@ -171,7 +171,7 @@ defmodule Project.Routes do
scope "/", Project do
# ...
authenticate :users

get "/", PageController, :index
end
# ...
Expand All @@ -180,7 +180,7 @@ end

Module `Sesamex.Routes` macro `authenticate: 2` keep logic for generation route_paths for model. Note that you should atom in plural form `:models`. There are 2 opts `only`, `except`, see examples:

- `only: [:module, :other_module]`
- `only: [:module, :other_module]`
- `except: [:module, :other_module]`

By default macros generate routes for controllers which shoud be scoped by model name, see example:
Expand All @@ -192,7 +192,7 @@ By default macros generate routes for controllers which shoud be scoped by model
# Generate routes
# registration_path GET /users/sign_up Project.User.RegistrationController :new
# ...

```

If you want to redifine controller name, use `controllers` Keywords list:
Expand All @@ -206,7 +206,7 @@ If you want to redifine controller name, use `controllers` Keywords list:
# Generate routes
# registration_path GET /users/sign_up Project.OtherController :new
# ...

```

#### Generation current model assigns in @conn:
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule Sesames.Mixfile do

def project do
[app: :sesamex,
version: "0.1.0",
version: "0.2.0",
elixir: "~> 1.3",
description: description(),
package: package(),
Expand Down

0 comments on commit da16de0

Please # to comment.