Very new to working with rails. I have implemented a basic login system using Devise. I am trying to add a couple of new fields (bio:string, name:string) into the sign_up pa
The problem seems with the strong parameters, look here and copy the code.
https://github.com/plataformatec/devise/blob/rails4/app/controllers/devise/registrations_controller.rb
Copy that file to the same location in your project app/controllers/devise/registrations_controller.rb
and change the code of the create action
# POST /resource
def create
# THIS LINE IS THE ONE YOU CHANGE
self.resource = build_resource(sign_up_params.merge(:bio, :name))
if resource.save
if resource.active_for_authentication?
set_flash_message :notice, :signed_up if is_navigational_format?
sign_up(resource_name, resource)
respond_with resource, :location => after_sign_up_path_for(resource)
else
set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_navigational_format?
expire_session_data_after_sign_in!
respond_with resource, :location => after_inactive_sign_up_path_for(resource)
end
else
clean_up_passwords resource
respond_with resource
end
end
I must tell you that Iam not pretty sure if this works because I don't use devise but seeing the code it seems it will work.