EnquiryForm
과 UniversityFeeInstallment
사이에 일대 다 많은 관계가 있습니다. EnquiryForm has_many
UniversityFeeInstallment. 다음
내가 라이언 베이츠에게 고전 중첩 된 형태의 기술을 사용하고저장하지 않기 위해 몽고이 - 수용 _ 중첩 된 _attributes
내가 콘트롤
{
"utf8"=>"✓",
"authenticity_token"=>"jqgiRlk606pDzMEAtS/mGoWz8T61PgyCkKdMzSHEiQA=",
"enquiry"=>{
"university_fee_installments_attributes"=>{
"1338318502006"=>{
"due_date"=>"2012-05-28",
"amount"=>"1200"
}
}
},
"commit"=>"Update Enquiry",
"id"=>"4fc3db492d6d130238000028"
}에서받는 params
입니다. 또한 모델 코드는 다음과 같습니다
has_many :development_fee_installments, :autosave => true
has_many :university_fee_installments, :autosave => true
accepts_nested_attributes_for :development_fee_installments
accepts_nested_attributes_for :university_fee_installments
컨트롤러 :
def update
@enquiry = Enauiry.find(params[:id])
if @enquiry.save
redirect_to enquiry_payments_path(@enquiry, :notice => "Installment details updated")
else
render 'edit_installments'
end
end
내가 university_fee_installments을 저장할 수 없습니다입니다.
컨트롤러 코드를 알려주십시오. – abhas
@Cage : 업데이트 된 컨트롤러 코드 – Pravin