Module: ActiveResource::Scopes

Defined in:
lib/active_resource/scopes.rb

Instance Method Summary collapse

Instance Method Details

#scope(name, *args, &block) ⇒ Object



15
16
17
18
# File 'lib/active_resource/scopes.rb', line 15

def scope(name, *args, &block)
  scopes[name = name.to_sym] = (args.first || block || lambda { |*args| where name => args })
  self.class.delegate name, :to => :scoped
end

#scopedObject



5
6
7
# File 'lib/active_resource/scopes.rb', line 5

def scoped
  ActiveResource::Scope.new(self)
end

#scopesObject



11
12
13
# File 'lib/active_resource/scopes.rb', line 11

def scopes
  @scopes ||= {}
end