I’m trying to pass a string from a variable in my Rails app to the database. It’s the user’s email address. I cannot for the life of me figure out why I’m getting an “undefined method `merge'” error.
Here’s the offending code:
<%= f.email_field :commenter, current_user.email %>
Any help will surely help. Cheers!
Rails expect the second argument to be a hash, so you’d want to do
Or better yet, set the
:commenterattribute in that particular model in the controller (after you initalize/build it), then you can leave out this value hax. That way, when use edit this, post the form, and get a validation error, the value will be what’s user were posting, notcurrent_user.email.