class Supplier < ActiveRecord::Base
has_one :account, foreign_key: "acc_sup_id", :autosave => true
self.primary_key = 'sup_id'
attr_accessible :name, :remark
end
class Account < ActiveRecord::Base
belongs_to :supplier, foreign_key: "acc_sup_id"
self.primary_key = 'acc_id'
self.table_name = 'accounts'
attr_accessible :dep, :rev
end
and netzke form is given as
class SupplierForm < Netzke::Basepack::Form
def configure(c)
c.model = 'Supplier'
super
c.items = [
{field_label: "Name", name: :name},
{field_label: "Remark", name: :remark},
{field_label: "Dep", name: :account__dep, xtype: :checkbox, nested_attribute: true},
{field_label: "Rev", name: :account__rev, xtype: :checkbox, nested_attribute: true}
]
end
end
Here I am getting two issues while saving
1) while inserting only name and remark is saved but not the nested attributes.
2) If the nested attribute fields set to checked the value is updated to DB but if unchecked update is not working
Two classes were created
and netzke form is given as
Here I am getting two issues while saving
1) while inserting only name and remark is saved but not the nested attributes. 2) If the nested attribute fields set to checked the value is updated to DB but if unchecked update is not working