Module: SmoothOperator::Associations
- Included in:
- Base
- Defined in:
- lib/smooth_operator/associations.rb,
lib/smooth_operator/associations/reflection.rb,
lib/smooth_operator/associations/has_many_relation.rb,
lib/smooth_operator/associations/association_reflection.rb
Defined Under Namespace
Classes: AssociationReflection, HasManyRelation, Reflection
Instance Method Summary
collapse
Instance Method Details
#belongs_to(association, options = {}) ⇒ Object
15
16
17
|
# File 'lib/smooth_operator/associations.rb', line 15
def belongs_to(association, options = {})
accepts_nested_objects(association, :belongs_to, options)
end
|
#has_many(association, options = {}) ⇒ Object
7
8
9
|
# File 'lib/smooth_operator/associations.rb', line 7
def has_many(association, options = {})
accepts_nested_objects(association, :has_many, options)
end
|
#has_one(association, options = {}) ⇒ Object
11
12
13
|
# File 'lib/smooth_operator/associations.rb', line 11
def has_one(association, options = {})
accepts_nested_objects(association, :has_one, options)
end
|
#rails_serialization ⇒ Object
31
32
33
|
# File 'lib/smooth_operator/associations.rb', line 31
def rails_serialization
get_option :rails_serialization, false
end
|
#reflect_on_all_associations(macro = nil) ⇒ Object
27
28
29
|
# File 'lib/smooth_operator/associations.rb', line 27
def reflect_on_all_associations(macro = nil)
macro ? reflections.values.select { |reflection| reflection.macro == macro } : reflections.values
end
|
#reflect_on_association(association) ⇒ Object
23
24
25
|
# File 'lib/smooth_operator/associations.rb', line 23
def reflect_on_association(association)
reflections[association]
end
|