Sha256: 243c723f42b6a7162ef8246d9184eee9c73b3a7e6db1df6f82304b025cc69668

Contents?: true

Size: 562 Bytes

Versions: 2

Compression:

Stored size: 562 Bytes

Contents

require 'espresso/model'
require 'espresso/collection'

module Espresso
  module Model
    included do
      named_scope :for_collection, :conditions => '1 = 1'
      named_scope :for_feed, :order => 'created_at DESC'
    end

    module ClassMethods
      # Collection of resources, found by params
      # @param [Hash] options options for ActiveRecord::Base#find
      # @return [Espresso::Collection, Array] collection of resources
      def collection(options = {})
        Espresso::Collection.new(self.for_collection, options)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
espresso-framework-0.3.0 lib/espresso/model/inherited_resources.rb
espresso-0.2.1 lib/espresso/model/inherited_resources.rb