hi all, how to add name field to devise controller. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c9bf092db8f5c10d0d47f88c31109e07%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
On 8 July 2013 10:52, mack gille <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLsa2bMqcsDk4tLeRwFJg0T-bfKoV1%3DKsqhsUdR%2Bcb6T4g%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
Colin Law wrote in post #1114719:> On 8 July 2013 10:52, mack gille <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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> > Colini din''t get any sources colin -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/76059da4e221650b1a903f8ce9f7a231%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
On 8 July 2013 13:27, mack gille <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Colin Law wrote in post #1114719: >> On 8 July 2013 10:52, mack gille <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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 colinDid 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-%E2%80%93-add-custom-fields-to-devise-user-model/ -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLtsgZ9cFy4Mi7HZ5nFy6GvqSkTDYzNy%3DniJOSQhCNHmSg%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
On Monday, July 8, 2013 8:31:01 AM UTC-4, Colin Law wrote:> > On 8 July 2013 13:27, mack gille <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org <javascript:>> > wrote: > > Colin Law wrote in post #1114719: > >> On 8 July 2013 10:52, mack gille <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org <javascript:>> > 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 > > 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-%E2%80%93-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. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/cf63fdd7-daa1-4c59-88d4-ceb90e1eb303%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
On 8 July 2013 14:58, mike <mruch-sRllvWT3TyAqDJ6do+/SaQ@public.gmane.org> wrote:> > > On Monday, July 8, 2013 8:31:01 AM UTC-4, Colin Law wrote: >> >> On 8 July 2013 13:27, mack gille <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> > Colin Law wrote in post #1114719: >> >> On 8 July 2013 10:52, mack gille <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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 >> >> 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-%E2%80%93-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.That is good to know, thanks Mike. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLs%3DbnqWX4JYR152rc-XsHz4a4YLG14qrLbk2ru1WAkPCQ%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.