Hey guys, I''m trying to merge a hash with another using the .merge! function. class User < ActiveRecord::Base serialize :preferences end This is what I end up with in the console:>> u = User.find(1) >> u.preferences.merge!{:test => 1}SyntaxError: compile error (irb):32: syntax error, unexpected tASSOC, expecting ''}'' u.preferences.merge!{:test => 1} ^ from (irb):32 from :0 Any ideas? Take care. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Oct 10, 8:22 am, Alex <alex.e.jons...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hey guys, > > I''m trying to merge a hash with another using the .merge! function. > > class User < ActiveRecord::Base > serialize :preferences > end > > This is what I end up with in the console: > > >> u = User.find(1) > >> u.preferences.merge!{:test => 1} > > SyntaxError: compile error > (irb):32: syntax error, unexpected tASSOC, expecting ''}'' > u.preferences.merge!{:test => 1} > ^ > from (irb):32 > from :0 > > Any ideas? > > Take care.u.preferences.merge!({:test => 1}) --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Of course! Thank you very much. On Oct 10, 8:58 am, Erol Fornoles <erol.forno...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Oct 10, 8:22 am, Alex <alex.e.jons...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hey guys, > > > I''m trying to merge a hash with another using the .merge! function. > > > class User < ActiveRecord::Base > > serialize :preferences > > end > > > This is what I end up with in the console: > > > >> u = User.find(1) > > >> u.preferences.merge!{:test => 1} > > > SyntaxError: compile error > > (irb):32: syntax error, unexpected tASSOC, expecting ''}'' > > u.preferences.merge!{:test => 1} > > ^ > > from (irb):32 > > from :0 > > > Any ideas? > > > Take care. > > u.preferences.merge!({:test => 1})--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---