what is the difference between named_scope and method?
问题 named_scope or scope how difference with class method. named_scope :active, :conditions => {:status => 'Active'} def self.active self.find(:all, :conditions => {:status => 'Active'} end Whats the difference between the two? 回答1: In the end 'scope' will define a chainable class method on your model. That's why every class method, that returns a 'scope' (which is an object of the class ActiveRecord::Relation) can be used in the same way a definied scope / named_scope can. If you want to find