@trip = Trip.find(params[:trip_id]) @participant = @trip.participants.new(params[:participant])
if @participant.save redirect_to @trip else render 'new' end > Is there a reason to prefer #create? It's probably a question of taste and doesn't matter much. You could write the same code like that: @trip = Trip.find(params[:trip_id]) if @trip.participants.create(params[:participant]).valid? redirect_to @trip else render 'new' end - Matt On Wed, Jan 2, 2013 at 10:02 PM, Chris Radcliff <[email protected]>wrote: > @trip = Trip.find(params[:trip_id]) > @participant = @trip.participants.new(params[:participant]) > > if @participant.save > redirect_to @trip > else > render 'new' > end > > Is there a reason to prefer #create? > -- SD Ruby mailing list [email protected] http://groups.google.com/group/sdruby
