Frage

Does anybody know any simple_form or formtastic input for hstore? I tried to search for any input but I didn't find any yet... It seems that the hstore field type is not yet supported...

I would need it...

War es hilfreich?

Lösung

You may use like this for input as hstore:

 <%= 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 %>

Andere Tipps

Its not supported directly. But you can do something like this

<%= f.simple_fields_for :settings do |setting| %>
    <%= setting.input :color, :input_html => { :value => <value> } %>
    <%= setting.input :height, :input_html => { :value => <value> } %>
<% end %>
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top