# What do u think of this cool technique? Can you see a flaw?

**URL:** <https://www.ruby-forum.com/t/what-do-u-think-of-this-cool-technique-can-you-see-a-flaw/109194>\
**Category:** Rails\
**Created:** [July 12, 2007, 10:37am UTC](https://www.ruby-forum.com/t/what-do-u-think-of-this-cool-technique-can-you-see-a-flaw/109194 "2007-07-12T10:37:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![crenner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/278dde/32.png) [@crenner](https://www.ruby-forum.com/u/crenner)\
**Post date:** [July 12, 2007, 10:37am UTC](https://www.ruby-forum.com/t/what-do-u-think-of-this-cool-technique-can-you-see-a-flaw/109194/1 "2007-07-12T10:37:10Z")

</div>

I saw this somewhere and thought it looked damn nice :

def new  
@user = User.new  
end

def create  
@user = User.new(params[:user])  
@user.save!  
self.current\_user = @user  
redirect\_back\_or\_default(’/’)  
flash[:notice] = “Thanks for signing up!”  
rescue ActiveRecord::RecordInvalid  
render :action =\> ‘new’  
end

so save! returns an exception instead of false if it couldn’t happen,  
which is then caught with the rescue block.

It gets rid of an if, else block.

Can anyone see a flaw? or a reason why this might be crappy?

Thanks,  
Chris
