Forum: Ruby on Rails validation for items in a 1 2 many

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
James M. (Guest)
on 2006-03-04 14:43
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 =

  def create
    @cv = Cv.find(@session[:cv_id])
    @cv.skills <<[:skill])
      flash[:notice] = 'Skill was successfully created.'
      redirect_to :action => 'show', :controller => 'cv_admin', :id =>
      render :action => 'new'

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

any idea how to make the standard helpers work in this 1 to many world?

James M. (Guest)
on 2006-03-05 03:19
James McCarthy wrote:
please ignore... newbie error!
This topic is locked and can not be replied to.