undefined method `merge’ for 5:Fixnum – Hidden Field

Just a quick post on an error I ran into today while using hidden fields:

undefined method `merge' for 5:Fixnum
27:   <div class="actions">
28:     <%= f.submit :class => 'button' %>
29:   </div>
30:   <%= f.hidden_field(:product_id, @upload.product_id) %>
31: <% end %>

Thankfully this is an easy fix, simply amend your code as follows:

  1. <div class="actions">
  2.     <%= f.submit :class => 'button' %>
  3. </div>
  4.    <%= f.hidden_field :product_id, :value => @upload.product_id %>
  5. <% end %>

And that’s all there is to it, let me know if there are any issues.

2 thoughts on “undefined method `merge’ for 5:Fixnum – Hidden Field

  1. Josh Johnson

    Thanks so much for this!!! I was pulling my hair out with frustration over this problem. Your solution took care of it perfectly!


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.