Jump to content

The ultimate community for Ruby on Rails developers.


Photo

Unpermitted Parameters: login

ruby devise

  • Please log in to reply
3 replies to this topic

#1 Railz4Ruby2022

Railz4Ruby2022

    Dispatcher

  • Members
  • 36 posts

Posted 22 September 2014 - 08:16 PM

I've followed behind the instructions for the extended devise user model w/email or username login to no avail.

 

https://github.com/p...r-email-address

 

I'm unable to commit actions to the forms login, and it's forcing a refresh of the page itself. I did exactly what the wiki said. Maybe you can help me solve this problem. (Or give me proper instructions for Ruby on Rails 4.)

 

Unpermitted parameters: login
   (0.0ms)  begin transaction
   (0.0ms)  rollback transaction

 

UPDATE:

I used text_field :login instead of text_field :username......But, now I'm having trouble with the authenticity token. It begins transaction, and then it rolls back.



#2 ajaysahu

ajaysahu

    Dispatcher

  • Members
  • 30 posts

Posted 23 September 2014 - 11:28 AM

as you are adding username field to devise then make sure you add it to permission list : 

#application_controller.rb 

before_filter :update_sanitized_params, if: :devise_controller?
 
def update_sanitized_params
  devise_parameter_sanitizer.for(:sign_up) {|u| u.permit(:username)}
end

Check this link as well: 

https://github.com/p...rong-parameters

As you have mentioned, it redirects back to login page, then I would suggest you to inspect the resource object for any error messages if present. 
raise resource.inspect   or raise resource.errors.messages.inspect 
Hope that helps !!!!

 



#3 Railz4Ruby2022

Railz4Ruby2022

    Dispatcher

  • Members
  • 36 posts

Posted 23 September 2014 - 03:39 PM

as you are adding username field to devise then make sure you add it to permission list : 

#application_controller.rb 

before_filter :update_sanitized_params, if: :devise_controller?
 
def update_sanitized_params
  devise_parameter_sanitizer.for(:sign_up) {|u| u.permit(:username)}
end

Check this link as well: 

https://github.com/p...rong-parameters

As you have mentioned, it redirects back to login page, then I would suggest you to inspect the resource object for any error messages if present. 
raise resource.inspect   or raise resource.errors.messages.inspect 
Hope that helps !!!!

 

Can you write out the instructions step by step. Because, I've been trying everything.



#4 Railz4Ruby2022

Railz4Ruby2022

    Dispatcher

  • Members
  • 36 posts

Posted 25 September 2014 - 07:36 PM   Best Answer

I finally got some clarity with this problem with the username/email login. Here is the tutorial for the process if someone else is faced with this issue.

 

http://rubyonrailshe...rname-or-email/

 

Create the model/migrate, and then follow the instructions. The github tutorial was a bit verbose. This iteration is easier to read.







Also tagged with one or more of these keywords: ruby, devise

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users