chovy
2007-Dec-31 11:52 UTC
episode 73 resulting in error: undefined method `stringify_keys!'' for "33":String
I''m working with a similar model in Episode 73, (my scenario is editing multiple pictures for a product using attachment_fu). And I''m getting an error when I try the technique suggested: ./views/admin/_form.rhtml <% for picture in product.pictures %> <% fields_for "product[picture_attributes][]", picture do | picture_form| %> Title: <%= picture_form.text_field :title %> <% end %> ./models/product.rb def picture_attributes=(picture_attributes) picture_attributes.each do |attributes| pictures.build(attributes) end end undefined method `stringify_keys!'' for "33":String Parameters: {"commit"=>"Edit", "product"=>{"image_url"=>"shep.jpg", "price"=>"400.00", "title"=>"German Shepard Lab Mix #2b", "category_ids"=>["6"], "picture_attributes"=>{"33"=>{"title"=>"asdf2"}, "24"=>{"title"=>"asdf"}, "27"=>{"title"=>"asdf"}, "30"=>{"title"=>"asdf"}}, "description"=>"3 year old german shepard lab mix. Test!"}, "id"=>"23", "picture"=>{"uploaded_data"=>""}} I noticed in the video, it shows the "picture_attributes" parameter as an array (not a hash is it shows on mine). --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Jan Luehr
2007-Dec-31 12:23 UTC
Re: episode 73 resulting in error: undefined method `stringify_keys!'' for "33":String
Hello, Am Montag, 31. Dezember 2007 schrieb chovy:> I''m working with a similar model in Episode 73, (my scenario is > editing multiple pictures for a product using attachment_fu). > > And I''m getting an error when I try the technique suggested: > > ./views/admin/_form.rhtml > > <% for picture in product.pictures %> > <% fields_for "product[picture_attributes][]", picture do | > picture_form| %> > Title: <%= picture_form.text_field :title %> > <% end %>Try <%= picture_form.text_field :title, :index=> nil %> as suggested in the episode. Keep smiling yanosz --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
chovy
2007-Dec-31 13:29 UTC
Re: episode 73 resulting in error: undefined method `stringify_keys!'' for "33":String
On Dec 31, 3:52 am, chovy <ettin...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m working with a similar model in Episode 73, (my scenario is > editing multiple pictures for a product using attachment_fu). > > And I''m getting an error when I try the technique suggested: > > ./views/admin/_form.rhtml > > <% for picture in product.pictures %> > <% fields_for "product[picture_attributes][]", picture do | > picture_form| %> > Title: <%= picture_form.text_field :title %> > <% end %> > > ./models/product.rb > def picture_attributes=(picture_attributes) > picture_attributes.each do |attributes| > pictures.build(attributes) > end > end > > undefined method `stringify_keys!'' for "33":String > > Parameters: {"commit"=>"Edit", "product"=>{"image_url"=>"shep.jpg", > "price"=>"400.00", "title"=>"German Shepard Lab Mix #2b", > "category_ids"=>["6"], > "picture_attributes"=>{"33"=>{"title"=>"asdf2"}, > "24"=>{"title"=>"asdf"}, "27"=>{"title"=>"asdf"}, > "30"=>{"title"=>"asdf"}}, "description"=>"3 year old german shepard > lab mix. Test!"}, "id"=>"23", "picture"=>{"uploaded_data"=>""}} > > I noticed in the video, it shows the "picture_attributes" parameter as > an array (not a hash is it shows on mine).Nevermind, episode #75 had the solution :) --~--~---------~--~----~------------~-------~--~----~ 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
- 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?
- undefined method `stringify_keys!'