class ActiveAny::Associations::CollectionProxy

Attributes

association[R]

Public Class Methods

new(klass, association) click to toggle source
Calls superclass method ActiveAny::Relation::new
# File lib/active_any/associations/collection_proxy.rb, line 11
def initialize(klass, association)
  @association = association
  super(klass)
end

Public Instance Methods

==(other) click to toggle source
# File lib/active_any/associations/collection_proxy.rb, line 30
def ==(other)
  load_target == other
end
last(limit = nil) click to toggle source
Calls superclass method ActiveAny::Relation::FinderMethods#last
# File lib/active_any/associations/collection_proxy.rb, line 16
def last(limit = nil)
  load_target if find_from_target?
  super
end
proxy_association() click to toggle source
# File lib/active_any/associations/collection_proxy.rb, line 43
def proxy_association
  @association
end
records() click to toggle source
# File lib/active_any/associations/collection_proxy.rb, line 39
def records
  load_target
end
reload() click to toggle source
# File lib/active_any/associations/collection_proxy.rb, line 53
def reload
  proxy_association.reload
  reset_scope
end
reset() click to toggle source
# File lib/active_any/associations/collection_proxy.rb, line 47
def reset
  proxy_association.reset
  proxy_association.reset_scope
  reset_scope
end
scope() click to toggle source
# File lib/active_any/associations/collection_proxy.rb, line 26
def scope
  @scope ||= @association.scope
end
take(limit = nil) click to toggle source
Calls superclass method ActiveAny::Relation::QueryMethods#take
# File lib/active_any/associations/collection_proxy.rb, line 21
def take(limit = nil)
  load_target if find_from_target?
  super
end
to_a()
Alias for: to_ary
to_ary() click to toggle source
# File lib/active_any/associations/collection_proxy.rb, line 34
def to_ary
  load_target.dup
end
Also aliased as: to_a

Private Instance Methods

find_from_target?() click to toggle source
# File lib/active_any/associations/collection_proxy.rb, line 66
def find_from_target?
  @association.find_from_target?
end