I have seen this numerious times and still have no idea what it means: undefined method `stringify_keys!'' for "blah22":String I am tring to change a password. My code looks like: def change_password @user = User.find_by_emailaddr( params[:email] ) if @user.nil? # user profile not created flash[:notice] = "<b style = \"color:red\">No such user email found</b>" redirect_to :action => ''change_pass'' and return end if User.authenticate( params[:email], params[:current_pass] ) and !@user.nil? if params[:new_pass] == params[:new_passvfy] begin @user.update_attributes(@user.setpass = params[:new_pass]) rescue Exception => e flash[:notice] = e redirect_to :action => ''change_pass'' else redirect_to :action => ''traveler_form'' and return end else flash[:notice] = "<b style =\"color:red\">New password fields don''t match</b>" redirect_to :action => ''change_pass'' end else flash[:notice] = "<b style = \"color:red\">Unknown User</b>" redirect_to :action => ''change_pass'' and return end end Once upon a time this all worked. Then I made some changes in another part of the controller to get something else working on another page, but odviously this two parts are related somehome, but I don''t see how. Where is the ''stringify_keys!'' coming from and what does it mean? Thanks in advance, -S -- 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
stringify_keys! destructively converts has keys to strings. You are getting this error because you are passing a string to a function that is expecting a hash. http://api.rubyonrails.com/classes/ActiveSupport/CoreExtensions/Hash/Keys.html Shandy Nantz wrote:> I have seen this numerious times and still have no idea what it means: > > undefined method `stringify_keys!'' for "blah22":String > > I am tring to change a password. My code looks like: > > def change_password > @user = User.find_by_emailaddr( params[:email] ) > > if @user.nil? # user profile not created > flash[:notice] = "<b style = \"color:red\">No such user email > found</b>" > redirect_to :action => ''change_pass'' and return > end > > if User.authenticate( params[:email], params[:current_pass] ) and > !@user.nil? > if params[:new_pass] == params[:new_passvfy] > begin > @user.update_attributes(@user.setpass = params[:new_pass]) > rescue Exception => e > flash[:notice] = e > redirect_to :action => ''change_pass'' > else > redirect_to :action => ''traveler_form'' and return > end > else > flash[:notice] = "<b style =\"color:red\">New password fields > don''t > match</b>" > redirect_to :action => ''change_pass'' > end > else > flash[:notice] = "<b style = \"color:red\">Unknown User</b>" > redirect_to :action => ''change_pass'' and return > end > end > > Once upon a time this all worked. Then I made some changes in another > part of the controller to get something else working on another page, > but odviously this two parts are related somehome, but I don''t see how. > Where is the ''stringify_keys!'' coming from and what does it mean? Thanks > in advance, > > -S >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Sorry for the typo, still haven''t had my first cup of coffee :) stringify_keys! destructively converts hash keys to strings. William Pratt wrote:> stringify_keys! destructively converts has keys to strings. You are > getting this error because you are passing a string to a function that > is expecting a hash. > http://api.rubyonrails.com/classes/ActiveSupport/CoreExtensions/Hash/Keys.html > > Shandy Nantz wrote: > >> I have seen this numerious times and still have no idea what it means: >> >> undefined method `stringify_keys!'' for "blah22":String >> >> I am tring to change a password. My code looks like: >> >> def change_password >> @user = User.find_by_emailaddr( params[:email] ) >> >> if @user.nil? # user profile not created >> flash[:notice] = "<b style = \"color:red\">No such user email >> found</b>" >> redirect_to :action => ''change_pass'' and return >> end >> >> if User.authenticate( params[:email], params[:current_pass] ) and >> !@user.nil? >> if params[:new_pass] == params[:new_passvfy] >> begin >> @user.update_attributes(@user.setpass = params[:new_pass]) >> rescue Exception => e >> flash[:notice] = e >> redirect_to :action => ''change_pass'' >> else >> redirect_to :action => ''traveler_form'' and return >> end >> else >> flash[:notice] = "<b style =\"color:red\">New password fields >> don''t >> match</b>" >> redirect_to :action => ''change_pass'' >> end >> else >> flash[:notice] = "<b style = \"color:red\">Unknown User</b>" >> redirect_to :action => ''change_pass'' and return >> end >> end >> >> Once upon a time this all worked. Then I made some changes in another >> part of the controller to get something else working on another page, >> but odviously this two parts are related somehome, but I don''t see how. >> Where is the ''stringify_keys!'' coming from and what does it mean? Thanks >> in advance, >> >> -S >> >> > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
William Pratt wrote:> Sorry for the typo, still haven''t had my first cup of coffee :) > > stringify_keys! destructively converts hash keys to strings.Thanks. That makes perfect sense. Im my user model I was using ''update_attributes'' and then passing in one of my param arguments instead of the entire set of parameters. Once I changed that everything worked, Thanks again, --Shandy -- 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Possibly Parallel Threads
- Agile Web Dev w/Rails - Password Change
- undefined method `stringify_keys'
- HELP: NoMethodError (undefined method `stringify_keys!'' for
- Help with a select_tag; getting an undefined method `stringify_keys' error
- undefined method `stringify_keys!' for "4":String - Meaning of this?