Updating attributes of another model

I hve a relationship like this in my model:
Student
has_one :student_fail

StudentFail
belongs_to :student_fail_state
belongs_to :student

StudentFailState
has_many :students, :through => :student_fail
has_many :student_fails

In terms of the controller, what would be the best way to update
attributes to the student_fails table?

Here’s the view stuff:

resources_form_helper.rb:
def render_form_collection_field(form, name, label = nil, size = nil)
render_form_field(form, name, label) do
params = yield
form.collection_select name, params[:collection],
params[:value_method],params[:text_method], {}, {:size => size}
end
end

def render_form_field(form, name, label=nil)
label ||= name.to_s.gsub(/id$/, ‘’).gsub(’’, ’ ')
label_class = “error” if error_fields.include?(name.to_sym)
<<END_HTML

  • #{form.label name, label, :class => label_class}
    #{yield}
  • END_HTML end view: [ render_form_collection_field(f, :student_fail_state_id, 'level') { { :collection => StudentFailState.true, :value_method => :id, :text_method => :name} } ] #:student_fail_state_id doesn't currently working because it's not in the student table.

    Any suggestions on how to update other tables from a dropdown menu?
    Thanks.

    http://ryandaigle.com/articles/2009/2/1/what-s-new-in-edge-rails-nested-attributes