Is there a way to use accepts_nested_attributes_for to update another table from within a controller. For example, I have this in my students controller:
def student_fail
@student = Subject.find(params[:id]) if params[:id]
@student.build_student_fail
end
def student_fail_finalize
if @student.update_attributes params[:student]
@subject.save
end
end
I have this model relationship:
Student
has_one :student_fail
accepts_nested_attributes_for :student_fail, :allow_destroy => true
StudentFail
belongs_to :student_fail_state
belongs_to :student
StudentFailState
has_many :students, :through => :student_fail
has_many :student_fails
From the students controller, when the user fills out a form, I just want to update that information to the student_fail table. Can I achieve this through the controller using accepts_nested_attributes_for?