On Wed, Jan 2, 2013 at 3:49 PM, Hillary Hueter <[email protected]> wrote:
> Thanks. So when i add a participant i pass in the param[:trip_id] to the > create controller? > Yes. Assuming that you have Trip and Participant associated in the model: class Trip ... has_many :participants end class Participant ... belongs_to :trip end you can set the trip in participant#create either directly with @participant.trip_id = param[:trip_id], or by looking up the trip and creating the participant off it. My preferred way: @trip = Trip.find(params[:trip_id]) @participant = @trip.participants.new(params[:participant]) ~chris -- SD Ruby mailing list [email protected] http://groups.google.com/group/sdruby
