[LRUG] [Chat] IronRuby

Tom Ward tom at popdog.net
Tue Jul 24 07:17:40 PDT 2007


On 24/07/07, Pratik Naik <pratik at thinkwares.com> wrote:
> > def create
> >   @person = Person.new(params[:person])
> >   @person.save!
> >   redirect_to :index
> > rescue
> >   # validation failed, go back to form
> >   redirect_to :new
> > end
>
> Actually, a better way to write that would be something like :
>
> def create
>  @person = Person.new(params[:person])
>  @person.save!
>  redirect_to :index
> rescue ActiveRecord::RecordInvalid
>   render :action => 'new'
> end

True, that is an improvement, though mine was only meant to illustrate
the pattern.  The point I was trying to make is that to me this whole
pattern smells bad!  That said, not everyone agrees with me:

http://c2.com/cgi/wiki?DontUseExceptionsForFlowControl

Tom



More information about the Chat mailing list