55502f40dc8b7c769880b10874abc9d0

I need optimize this

named_scope :city,  lambda { |*args|
    if (args.first != "all_city")
      { :conditions => ["users.city = ?", args.first]  }
    end
  }

Refactorings

No refactoring yet !

A8d3f35baafdaea851914b17dae9e1fc

Adam

March 27, 2009, March 27, 2009 04:42, permalink

No rating. Login to rate!
class User < ActiveRecord::Base
  named_scope :within_city, lambda { |city|
    { :conditions => { :city => city } } unless city == 'all_city' }
end

Your refactoring





Format Copy from initial code

or Cancel