How to add name field to devise controller

hi all,
how to add name field to devise controller.

On 8 July 2013 10:52, mack gille [email protected] wrote:

hi all,
how to add name field to devise controller.

Have a look at [1], it may be helpful.

[1]
https://www.google.co.uk/search?q=how+to+add+name+field+to+devise+controller&ie=UTF-8

Colin

Colin L. wrote in post #1114719:

On 8 July 2013 10:52, mack gille [email protected] wrote:

hi all,
how to add name field to devise controller.

Have a look at [1], it may be helpful.

[1]

https://www.google.co.uk/search?q=how+to+add+name+field+to+devise+controller&ie=UTF-8

Colin

i din’t get any sources colin

On 8 July 2013 13:27, mack gille [email protected] wrote:

Colin

i din’t get any sources colin

Did not [2] help? For me it was linked to by the second result in
google (the first was your question itself).

Colin

[2]
http://eureka.ykyuen.info/2011/03/03/rails-–-add-custom-fields-to-devise-user-model/

On Monday, July 8, 2013 8:31:01 AM UTC-4, Colin L. wrote:

google (the first was your question itself).

Colin

[2]

http://eureka.ykyuen.info/2011/03/03/rails-–-add-custom-fields-to-devise-user-model/

There’s one update to these links. These links tell you to add your
attribute (in your case, :username) to attr_accessible in the model
user.rb. Devise has be re-written since these links were written to use
strong parameters. Instead of adding the attr_accessible line to your
model, you need to create a custom controller which is a bit of work.
Following the example of these links, to add the attribute :username to
the model users, you would add the following users_controller.rb:

class UsersController < Devise::RegistrationsController

private

  def sign_up_params
     params.require(:user).permit(:username, :email, :password,

:password_confirmation)
end

  def account_update_params
     params.require(:user).permit(:username, :email, :password,

:password_confirmation, :current_password)
end

end

Note that the controller inherits from Devise::RegistrationsController,
not
ApplicationController.

You will then need to change your routes in config/routes.rb by adding
the
following lines:

devise_for :users, :controllers => { :registrations => “users” }

devise_scope :user do
resources :users
end

This is, obviously, considerable more work but will be necessary going
forward with strong parameters.

The other steps in the links provided still apply.

On 8 July 2013 14:58, mike [email protected] wrote:

Have a look at [1], it may be helpful.
Did not [2] help? For me it was linked to by the second result in
Devise has be re-written since these links were written to use strong
params.require(:user).permit(:username, :email, :password,
Note that the controller inherits from Devise::RegistrationsController, not

This is, obviously, considerable more work but will be necessary going
forward with strong parameters.

The other steps in the links provided still apply.

That is good to know, thanks Mike.

Colin