Hi all,
Just not sure how to do this in RoR.
Scenario:
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…
- want to create the new registration (works fine)
- 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 }
else
format.html { render :action => “springtraining” }
format.xml { render :xml => @registration.errors, :status
=> :unprocessable_entity }
end
end
end