Class: AutoScopes::AssociationsChains

Inherits:
Struct
  • Object
show all
Defined in:
lib/auto_scopes/associations_chains.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#associationObject

Returns the value of attribute association.



6
7
8
# File 'lib/auto_scopes/associations_chains.rb', line 6

def association
  @association
end

#associationsObject

Returns the value of attribute associations

Returns:

  • (Object)

    the current value of associations



2
3
4
# File 'lib/auto_scopes/associations_chains.rb', line 2

def associations
  @associations
end

#klassObject

Returns the value of attribute klass

Returns:

  • (Object)

    the current value of klass



2
3
4
# File 'lib/auto_scopes/associations_chains.rb', line 2

def klass
  @klass
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



2
3
4
# File 'lib/auto_scopes/associations_chains.rb', line 2

def path
  @path
end

Instance Method Details

#look_inside_chainObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/auto_scopes/associations_chains.rb', line 8

def look_inside_chain
  associations.each_pair do |association_parent, association|
  	self.association = association

  	path.push(association_parent)

    method_maker.create_association if config.create_scope_for_association

    if nested_hash?
    	self.class.new(klass, association, path.clone).look_inside_chain
    else
    	call_methods_maker
    end
  end
end