Hi I'm new to ActiveAdmin, it's inherent Formtastic and Ruby (2.6) on Rails (6.1) and need to make a modification on an existing system.
To make it short, I have a Prices model, which is filled with data on a prices.html.erb form.
I need to add key/value pairs (eg: {"fee_1": 10, "fee_2": 20,...}) to be stored in a JSON "fees_list" column, in a MySQL database.
I'm having issues about how to modify the form to input the values.
Amongst many attempts so far, in the prices.html.erb Formtastic form I've tried (Edit: Thanks to Lam Phan for typo fix):
<%= f.inputs, for: => :fees_list do |j| %>
<%= j.input :fee_1, require: false, input_html: { value: resource.fees_list['fee_1'] } %>
<%= j.input :fee_2, require: false, input_html: { value: resource.fees_list['fee_2'] } %>
<%= end %>
Additional information is that I have a @prices reference available in the prices.html.erb file.
But the resulting page does not display the price inputs. Do I need some Gem to edit/show the JSON data in the DB?
Could someone help please? Thanks a lot to this great community in advance. Best regards!