#5 Using with_scope

Learn how to use with_scope - a very powerful method which will allow your custom find methods to accept any find options. Just like magic!
# models/task.rb
def self.find_incomplete(options = {})
  with_scope :find => options do
    find_all_by_complete(false, :order => 'created_at DESC')
  end
end

ps: Task.find_incomeplete :limit => 10

你可能感兴趣的:(java)