ruby on rails - Nested object not saved on create -


I am trying to make a new deliverable, which has delisted deliverable data. Deliverable features, such as title, save but do not have nested features in the delivery date. What am I missing?

Many thanks

  Class ProgramManager :: DeliverablesController & lt; Programmerager :: ApplicationController ... DRF New @DeliverBlue = @program.devilables.build@program.group.each Do | Group | Make @ Deliverable.deliverable_dates.build (group_id: group.id) end clean_deliverables 3.times {@ deliverable.select_options.build} end def delete_empty_select_options @deliverable = @ program.deliverables.new (parameter [: d]) clean_deliverables if @deliverable .save redirect_to program_deliverables_path (@program), success: 'Successfully built successfully' and 'program.groups.each do | Group | @ Deliverable.delverable_dates.build (group_id: group.id) finally render the new end to end ... and  

-

  & lt;% = Form_for [@ program, deliverable], html: {class: 'form-horizontal'} do | F | | & Gt%; & Lt;% = Render 'Share / Error_message', Object: Deliverable% & gt; ... & lt; Div class = "in-out";% = "hidden" deliverable.is_by_date?% & Gt; Id = "out in" & gt; For & lt;% = f.fields_: deliverable_dates do | D | & Gt%; & Lt; H5 & gt; & Lt;% = Group.find (d.object.group_id) .name% & gt; & Lt; / H5> & Lt; Div class = "form-group" & gt; & Lt;% = d.label: in_date, in 'Date', Category: 'col-md-2 control-label'% & gt; & Lt; Div class = "col-md-10" & gt; & Lt;% = d.text_field: in_date, class: 'form-control input-sm datepicker', id: 'deliverable_in_date_new', placeholder 'date'% & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Div class = "form-group" & gt; & Lt;% = d.label: out_date, 'out date', category: 'col-md-2 control-label'% & gt; & Lt; Div class = "col-md-10" & gt; & Lt;% = d.text_field: Aut_det class 'form-control input-SM Detpekr', id: 'Deliverable_out_date_new' placeholder 'out of date'% & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt;% end% & gt; & Lt; / Div & gt; ... & lt; Div class = "form-group" & gt; & Lt; Div class = "col-md-10 col-md-offset-2" & gt; & Lt;% = f.submit 'Save Changes', Category: 'BTN BTN-Primary'% & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt;% end% & gt;  

-

  class deviations & lt; ActiveRecord :: Base Folderable includes: Reportable attr_accessible: program_id ,: deliverable_type ,: is_by_date ,: title, file_cabinet_folder ,: select_options_attributes attr_accessor: in_data_cell ,: out_data_cell ,:__data_cell belong_to: program has_many: deliveryable_dates, dependent :: Has_many: select_options, as: optionable, dependent: deleted has_many: deliverable_data, dependent: as folder: deleted has_many: folderable, dependent: accepts_nested_attributes_for deliverable_dates: deleted representative: in_date ,: out_date ,: by_date, to: select_options, allow_destroy: true accepts for __ nested_attributes_: deliverable_dates, allow_destroy: true ... end  

-

Class DeliverableDate & lt; ActiveRecord :: Base attr_accessible: group_id ,: deliverable_id ,: in_date ,: out_date ,: by_date belongs_to: group belongs_to: renders validation: group_id, presence: true verifies: deliverable_id, presence: true scope: past_due, - & gt; ; {Where ('Outdate is not redundant and out-to-date?) Or (By-date faucet and by_date is not & lt ;?)', datatode, datatode)} Scope: Upcoming, - & gt; {Where ('? (In_date not null and in_date & gt; =) and (out_date is not empty and out_date & gt; =)) or (by_date is not empty and by_date & gt; =)', Date.today, Date, Date, Date, Date) Today: Scope: Current_DeliveryAB, - & gt; {Where ( '((by_date & gt; and by_date & LT ;? =) or (in_date & gt; and in_date & LT ;? =) or (out_date & gt; and in_date & LT ;? =) or (in_date & Gt; =? And out_date and lieutenant; =?), 'Date, today, 10. days. From now, detroit, 5.days.from_now, datedod, 5.days.from_now, date.today, date.today)} Text after "end

In order to 'abrecepts_nested_attributes_for' to work properly ": deliverable_dates_attributes" added To be attr_accessible for Deliverable


Comments