16 Nov '13, 9am

Porqué no es recomendable el habitual if @user.save else ... end

save bang your head, active record will drive you mad Jared Carroll September 26, 2007 rails 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 f...

Full article: http://robots.thoughtbot.com/save-bang-your-head-active-r...

Tweets

Import excel files to active record like a Pro!

rubyflow.com 15 Nov '13, 12pm

Import excel files to active record like a Pro! Posted by michelson on November 15, 2013 — 0 comments Active importer is a...

Lessons learned from an former start-up founder/erentrepreneur @bernardleong #startup #asia

Lessons learned from an former start-up founder...

bernardleong.com 20 Nov '13, 1am

Whether you are going to join a company as an employee or build a company, you are a startup in your own way. Everyone typ...

8 Topics Guaranteed to Drive Every Good SEO Consultant Mad by @andrealpar

8 Topics Guaranteed to Drive Every Good SEO Con...

searchenginejournal.com 17 Nov '13, 8pm

I’ve wanted to write an article like this for months. I’m a full-time SEO and have been doing this type of work since 1998...