Posts

Showing posts from April 11, 2019

How to edit a Rails serialized field in a form?

Image
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box; } 55 32 I have a data model in my Rails project that has a serialized field: class Widget < ActiveRecord::Base serialize :options end The options field can have variable data info. For example, here is the options field for one record from the fixtures file: options: query_id: 2 axis_y: 'percent' axis_x: 'text' units: '%' css_class: 'occupancy' dom_hook: '#average-occupancy-by-day' table_scale: 1 My question is what is the proper way to let a user edit this info in a standard form view? If you just use a simple text area field for the opt