netzke - Autosave issue in rails 3.2 -


in given code,

class supplier < activerecord::base     has_one :criteria, foreign_key: "crt_sup_id", :autosave => true      self.primary_key = 'sup_id'   end    class criteria < activerecord::base     belongs_to :supplier, foreign_key: "crt_sup_id"     self.primary_key = 'crt_id'     self.table_name = 'criterias'   end   

autosave not working when submitting form. supplier records created not criteria.

form code

    class supplierform < netzke::basepack::form       def configure(c)         c.model = 'supplier'         super         c.items = [           {field_label: "name", name: :bname},           {field_label: "detail", name: :detail},           {             layout: :hbox, border: false, defaults: {border: false}, items: [             {               flex: 1,               layout: :anchor,               defaults: {anchor: "-8"},               items: [                 {field_label: "value 1", name: :criteria__val_one, xtype: :checkbox, nested_attribute: true},                 {field_label: "value 2", name: :criteria__val_two, xtype: :checkbox, nested_attribute: true}                 ]             }             ]           }         ]       end     end   

controller code

def index end   

solved of netzke author. replace criteria__val_one criteria_val_one , criteria__val_two criteria_val_two. create virtual attributes in model class. values entered in form accessible these virtual attributes , can saved. credit goes max gorin. great work (netzke)


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -