Module: SmoothOperator::Relation::Associations
- Included in:
- Base
- Defined in:
- lib/smooth_operator/relation/associations.rb
Instance Method Summary collapse
- #belongs_to(nested_object_name, options = {}) ⇒ Object
- #has_many(nested_object_name, options = {}) ⇒ Object
- #has_one(nested_object_name, options = {}) ⇒ Object
- #reflect_on_all_associations(macro = nil) ⇒ Object
- #reflect_on_association(association) ⇒ Object
- #reflections ⇒ Object
Instance Method Details
#belongs_to(nested_object_name, options = {}) ⇒ Object
16 17 18 |
# File 'lib/smooth_operator/relation/associations.rb', line 16 def belongs_to(nested_object_name, = {}) accepts_nested_objects(nested_object_name, :belongs_to, ) end |
#has_many(nested_object_name, options = {}) ⇒ Object
8 9 10 |
# File 'lib/smooth_operator/relation/associations.rb', line 8 def has_many(nested_object_name, = {}) accepts_nested_objects(nested_object_name, :has_many, ) end |
#has_one(nested_object_name, options = {}) ⇒ Object
12 13 14 |
# File 'lib/smooth_operator/relation/associations.rb', line 12 def has_one(nested_object_name, = {}) accepts_nested_objects(nested_object_name, :has_one, ) end |
#reflect_on_all_associations(macro = nil) ⇒ Object
28 29 30 |
# File 'lib/smooth_operator/relation/associations.rb', line 28 def reflect_on_all_associations(macro = nil) macro ? reflections.values.select { |reflection| reflection.macro == macro } : reflections.values end |
#reflect_on_association(association) ⇒ Object
24 25 26 |
# File 'lib/smooth_operator/relation/associations.rb', line 24 def reflect_on_association(association) reflections[association] end |
#reflections ⇒ Object
20 21 22 |
# File 'lib/smooth_operator/relation/associations.rb', line 20 def reflections Helpers.get_instance_variable(self, :reflections, {}) end |