Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lucasdavila/3715290 to your computer and use it in GitHub Desktop.
Save lucasdavila/3715290 to your computer and use it in GitHub Desktop.
Dynamic form for hstore attributes in rails
<%= simple_form_for @product do |f| %>
<%= f.simple_fields_for :attributes do |d| %>
<% f.object.attributes.try(:each) do |key, value| %>
<%= d.input key, :input_html => {:value => value } %>
<% end %>
<% end %>
<% end %>
@danielricecodes
Copy link

🤘

@maxirby
Copy link

maxirby commented Dec 30, 2016

How does form look like If I have multiple rows (array of products) ? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment