1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Update README.md

This commit is contained in:
Shinya Kitamura 2016-05-10 22:11:12 +08:00
parent 8286325fd0
commit 1beac93961

View file

@ -100,13 +100,13 @@ Run the bundle command to install it.
After you install Devise and add it to your Gemfile, you need to run the generator:
```console
rails generate devise:install
$ rails generate devise:install
```
The generator will install an initializer which describes ALL of Devise's configuration options. It is *imperative* that you take a look at it. When you are done, you are ready to add Devise to any of your models using the generator:
```console
rails generate devise MODEL
$ rails generate devise MODEL
```
Replace MODEL with the class name used for the applications users (its frequently `User` but could also be `Admin`). This will create a model (if one does not exist) and configure it with the default Devise modules. The generator also configures your `config/routes.rb` file to point to the Devise controller.
@ -270,7 +270,7 @@ We built Devise to help you quickly develop an application that uses authenticat
Since Devise is an engine, all its views are packaged inside the gem. These views will help you get started, but after some time you may want to change them. If this is the case, you just need to invoke the following generator, and it will copy all views to your application:
```console
rails generate devise:views
$ rails generate devise:views
```
If you have more than one Devise model in your application (such as `User` and `Admin`), you will notice that Devise uses the same views for all models. Fortunately, Devise offers an easy way to customize views. All you need to do is set `config.scoped_views = true` inside the `config/initializers/devise.rb` file.
@ -278,14 +278,14 @@ If you have more than one Devise model in your application (such as `User` and `
After doing so, you will be able to have views based on the role like `users/sessions/new` and `admins/sessions/new`. If no view is found within the scope, Devise will use the default view at `devise/sessions/new`. You can also use the generator to generate scoped views:
```console
rails generate devise:views users
$ rails generate devise:views users
```
If you would like to generate only a few sets of views, like the ones for the `registerable` and `confirmable` module,
you can pass a list of modules to the generator with the `-v` flag.
```console
rails generate devise:views -v registrations confirmations
$ rails generate devise:views -v registrations confirmations
```
### Configuring controllers
@ -295,7 +295,7 @@ If the customization at the views level is not enough, you can customize each co
1. Create your custom controllers using the generator which requires a scope:
```console
rails generate devise:controllers [scope]
$ rails generate devise:controllers [scope]
```
If you specify `users` as the scope, controllers will be created in `app/controllers/users/`.