Strong parameters with Rails and Devise -


i using rails 4.0 branch of devise along ruby 2.0.0p0 , rails 4.0.0.beta1.

this kind of question checking if i'm doing right way, or if there other things should doing. i'm sure lot of people moving rails 4.0 facing same problems (after googling similar things).

i have read following links:

now using devise created user model, created following controller using above gists (and made sure include in routes file). parameters first_name , last_name.

class users::registrationscontroller < devise::registrationscontroller   def sign_up_params     params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation)   end   def account_update_params     params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation, :current_password)   end   private :sign_up_params   private :account_update_params end 

is there else should doing? best way of doing things on (since dropping attr_accessor). forms seem working fine (both new , update). gists said use "resource_params" gave "unpermitted parameters" error in server log.

thanks latest updates on rails4 branch of devise, doesn't need insert 'resource_params'.

i've created brand new rails4 app , followed basic devise installation steps , app works properly, think, you've done well.

but there modified gist gives details in terms of permitted parameters if need:

source: https://gist.github.com/bluemont/e304e65e7e15d77d3cb9

# controllers/users/registrations_controller.rb class users::registrationscontroller < devise::registrationscontroller    before_filter :configure_permitted_parameters    protected    # custom fields :name, :heard_how   def configure_permitted_parameters     devise_parameter_sanitizer.for(:sign_up) |u|       u.permit(:name, :heard_how,         :email, :password, :password_confirmation)     end     devise_parameter_sanitizer.for(:account_update) |u|       u.permit(:name,         :email, :password, :password_confirmation, :current_password)     end   end end 

Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -