Module: NullObjectAssociations::SingletonMethods
- Defined in:
- lib/null_object_associations.rb
Defined Under Namespace
Modules: ArrayMethodMissing
Instance Method Summary
collapse
Instance Method Details
#has_many(name, actions = {}) ⇒ Object
Also known as:
has_and_belongs_to_many
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/null_object_associations.rb', line 19
def has_many(name, actions = {})
if actions[:respond_to] == :any
associations = []
associations.extend ArrayMethodMissing
else
actions = coerce_actions(actions)
associations = build_associations(actions)
end
define_method(name) do
associations
end
end
|
#has_one(name) ⇒ Object
Also known as:
belongs_to
35
36
37
|
# File 'lib/null_object_associations.rb', line 35
def has_one(name)
define_method(name) { nil }
end
|