Environment Mac OS X Rails 4.0.4 Ruby 2.1.1
Gems: simple_form
Create a model with a json typed field, here my migration file:
create_table :my_model do |t|
t.string :name
t.json :my_field
t.timestamps
end
And now when I try to create a New object (New form), I am getting this error
RuntimeError - No input found for json:
simple_form (3.0.2) lib/simple_form/form_builder.rb:551:in `find_mapping'
simple_form (3.0.2) lib/simple_form/form_builder.rb:482:in `find_input'
simple_form (3.0.2) lib/simple_form/form_builder.rb:111:in `input'
I am guessing that simple_form is not handling the JSON type very well, and I really don't know how to work around this one (newbie with simple_form).
Hope you can help
simple_form, doesn't support JSON
type natively. but as it turns out, JSON is text based data format, you can simple use textarea to output json.
<%= f.my_field, as: :text %>
this should work fine
Don't forget the comma, <%= f.input, as: :text %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With