I have a pre-populated Factor row that belongs to a Job (Job has one
Factor). The upd_factor form looks fine – brings in all expected
Factor data for that Job, but when I hit submit after making changes, it
throws the error at the end of this message.
def upd_factor
@the_factor = Factor.find_by_job_id(params[:job_id])
if request.post?
@the_factor.update_attributes(params[:the_factor])
redirect_to :action => ‘index’, :job_id => 22
end
end
(I commented out the one line to put focus on the update_attributes
line…) seems like what i’m trying to do is simple enough – any ideas
on what i’m missing?
MESSAGE:
You have a nil object when you didn’t expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.update_attributes
Thanks in advance!
-jp