Logic problem: writing to a second table from within the active controller

Hi all,

Just not sure how to do this in RoR.

Parents sign in to register their kids, child list populated based on
same last name (based on an imported excel file). Parents click
register next to childs name…process_registration action
called…code below…

  1. want to create the new registration (works fine)
  2. want to create the relationship between the parent and child in
    another model/table so I don’t have to guess the relationship in the
    future. Relationship model is created. 3 columns (id1(int),
    id2(int), type(string))

I’m getting the following error:
uninitialized constant RegistrationController::Relationship

So, how do I make this Relationship table available for writing???

def process_registration

@registration = Registration.new(params[:registration])
@relationship = Relationship.new( id1 => 'params[:registration]

[:parent_id]’, id2 => ‘params[:registration][:child_id]’, type =>
‘parentchild’ )

respond_to do |format| format
  if @registration.save
    flash[:notice] = "Player was successfully registered."
    format.html { redirect_to( :controller =>

‘registration’, :action => ‘springtraining’) }
format.xml { head :ok }
format.html { render :action => “springtraining” }
format.xml { render :xml => @registration.errors, :status
=> :unprocessable_entity }

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs