19 Apr '13, 8am

Exceptions should not be expected. #rubyonrails

September 25, 2007 thoughtbotjc save bang your head, active record will drive you mad So in my never-ending quest to remove conditional logic from code, I began writing my Rails actions like: def create @user = User.new params[:user] @user.save! redirect_to user_path(@user) rescue ActiveRecord::RecordNotSaved flash[:notice] = 'Unable to create user' render :action => :new end Instead of the traditional way using conditional logic like: def create @user = User.new params[:user] if @user.save redirect_to user_path(@user) else flash[:notice] = 'Unable to create user' render :action => :new end end I did this until one of my co-workers saw this and said: exceptions should not be expected What? When writing an application you expect invalid input from users. Since we expect invalid input we should NOT be handling it via exceptions because exceptions should only be used for unex...

Full article: http://robots.thoughtbot.com/post/159807850/save-bang-you...

Tweets

I should probably start using :inverse_of. Prob...

guides.rubyonrails.org 20 Apr '13, 11pm

is a connection between two Active Record models. Associations are implemented using macro-style calls, so that you can de...

@wtnabe ココを見る限りではどっちでも良い感じっぽいんですが…

guides.rubyonrails.org 21 Apr '13, 9am

is a connection between two Active Record models. Associations are implemented using macro-style calls, so that you can de...

VIDEO: See McLaren P1′s active aerodynamics at ...

paultan.org 19 Apr '13, 10am

VIDEO: See McLaren P1′s active aerodynamics at work By Hafriz Shah on April 19, 2013 Advanced aerodynamics play as big a p...

How have I never seen this before in Rails? Sup...

guides.rubyonrails.org 25 Apr '13, 8pm

because of argument safety. Putting the variable directly into the conditions string will pass the variable to the databas...

Fantastic courses drive golfers to Cancun

aluxurytravelblog.com 19 Apr '13, 3pm

Fantastic courses drive golfers to Cancun By Laura Faragher on Apr 19, 2013 in Leisure Travel , Mexico , North America , R...

=8

=8

cleantechnica.com 17 Apr '13, 1am

On Monday, the 15th of April, 2013, the approximate 1.3 million solar power systems in Germany set a new domestic/world re...

5 - Road Closure - Mountcastle Drive North on Sunday 5 April

5 - Road Closure - Mountcastle Drive North on S...

lothianbuses.com 19 Apr '13, 4pm

Mountcastle Drive North Sunday 21 April From 0900 hrs until 1700 hrs on Sunday 21 April service 5 will be unable to use Mo...