Class: GroupedScope::AssociationReflection
- Inherits:
-
ActiveRecord::Reflection::AssociationReflection
- Object
- ActiveRecord::Reflection::AssociationReflection
- GroupedScope::AssociationReflection
- Defined in:
- lib/grouped_scope/association_reflection.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(active_record, ungrouped_name) ⇒ AssociationReflection
constructor
A new instance of AssociationReflection.
- #respond_to?(method, include_private = false) ⇒ Boolean
- #ungrouped_reflection ⇒ Object
Constructor Details
#initialize(active_record, ungrouped_name) ⇒ AssociationReflection
Returns a new instance of AssociationReflection.
11 12 13 14 15 16 17 18 |
# File 'lib/grouped_scope/association_reflection.rb', line 11 def initialize(active_record,ungrouped_name) @active_record = active_record @ungrouped_name = ungrouped_name @name = :"grouped_scope_#{@ungrouped_name}" verify_ungrouped_reflection super(ungrouped_reflection.macro, @name, ungrouped_reflection..dup, @active_record) create_grouped_association end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object (private)
31 32 33 |
# File 'lib/grouped_scope/association_reflection.rb', line 31 def method_missing(method, *args, &block) ungrouped_reflection.send(method, *args, &block) end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'lib/grouped_scope/association_reflection.rb', line 9 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
9 10 11 |
# File 'lib/grouped_scope/association_reflection.rb', line 9 def end |
Instance Method Details
#respond_to?(method, include_private = false) ⇒ Boolean
24 25 26 |
# File 'lib/grouped_scope/association_reflection.rb', line 24 def respond_to?(method, include_private=false) super || ungrouped_reflection.respond_to?(method,include_private) end |
#ungrouped_reflection ⇒ Object
20 21 22 |
# File 'lib/grouped_scope/association_reflection.rb', line 20 def ungrouped_reflection @active_record.reflections[@ungrouped_name] end |