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? I don't
want to add anything to the view that indicates the other model. I'm
hoping to do it directly in the controller. Thanks for any suggestions.
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to