IIRC #build and #new are the same now. On Jan 2, 2013, at 10:02 PM, Chris Radcliff <[email protected]> wrote:
I'm not familiar with #build, but I tend to prefer #new to #create so I can check the result of #save for errors: @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? ~chris On Wed, Jan 2, 2013 at 6:27 PM, Matt Aimonetti <[email protected]>wrote: > My ActiveRecord might be rusty, but wouldn't the following more > appropriate? > > @trip = Trip.find(params[:trip_id]) > @participant = @trip.participants.build(params[:participant]) > > or > > @trip = Trip.find(params[:trip_id]) > @participant = @trip.participants.create(params[:participant]) > > ? > > -- SD Ruby mailing list [email protected] http://groups.google.com/group/sdruby -- SD Ruby mailing list [email protected] http://groups.google.com/group/sdruby
