I am populating a table skills which relate to a table cv in a 1 cv to
many skills relationship…
I populate the skills as below;
def new
@session[:cv_id] = params[:id]
@skill = Skill.new
end
def create
@cv = Cv.find(@session[:cv_id])
@cv.skills << Skill.new(params[:skill])
if @cv.save
flash[:notice] = ‘Skill was successfully created.’
redirect_to :action => ‘show’, :controller => ‘cv_admin’, :id =>
@cv
else
render :action => ‘new’
end
end
Having got the create method to populate correctly, the validation
helpers in the skills model have stopped working they trap errors on the
form and send the form back, but the;
<%= error_messages_for ‘skill’ %>
no longer works as it just has errors associated with cv rather than
skill…
any idea how to make the standard helpers work in this 1 to many world?
Thanks