Class: ScopeChain::AssociationChain

Inherits:
Object
  • Object
show all
Defined in:
lib/scope_chain.rb

Defined Under Namespace

Classes: MissingAssociationError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(instance) ⇒ AssociationChain

Returns a new instance of AssociationChain.



22
23
24
# File 'lib/scope_chain.rb', line 22

def initialize(instance)
  self.instance = instance
end

Instance Attribute Details

#association=(value) ⇒ Object

Sets the attribute association

Parameters:

  • value

    the value to set the attribute association to.



20
21
22
# File 'lib/scope_chain.rb', line 20

def association=(value)
  @association = value
end

#association_nameObject

Returns the value of attribute association_name.



20
21
22
# File 'lib/scope_chain.rb', line 20

def association_name
  @association_name
end

#instanceObject

Returns the value of attribute instance.



20
21
22
# File 'lib/scope_chain.rb', line 20

def instance
  @instance
end

Instance Method Details

#as(association_name) ⇒ Object



26
27
28
29
30
# File 'lib/scope_chain.rb', line 26

def as(association_name)
  self.association_name = association_name

  chain
end