i'm having problem understanding how save model spans 2 tables. json object item i'm trying save looks this:
{ "attributes": { "hardware_id": 3, "ip_address": 10.5.2.68, "name": "test device", "release": "v0.2.3", "properties": { "hardware_id": 3, "password": null, "wifi_visit_threshold_autocal": -100, "last_wifi_autocal_date": 1, "visit_threshold": -50, "inner_threshold": -30 } } }
and model follows:
class hardware include jsonclient::model include timestampaccessor .... attributes scalar :hardware_id, :ip_address, :name, :release end
the problem i'm facing hardware fields in 1 table, , properties located in reasons beyond control.
to able save hardware attributes , properties same form, need create jsonclient model properties , define 1 one relation between hardware model , hardware properties model?
i've read in other posts accepts_nested_attributes_for
may answer looking for, new rails i'm getting pretty lost how create form more save fields in same model.
thank in advance cah offer.