A friendly way for users to edit JSON fields in Rails forms.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install rails_json_field
Note: This gem currently requires jQuery to work.
//= require rails_json_field
Now you're able to use it in forms:
= form_for @foo do |f| = f.json_field :bar
Some future features include:
- Removing the jQuery dependency (if possible)
- Custom class names
- Better default styling
- Nested objects
- Array objects
A special thank you to the john_hancock gem for showing me how to structure this kind of gem.