Module: Reamaze::PortableHole::AssociationExtensions
- Defined in:
- lib/portable-hole/association_extensions.rb
Instance Method Summary collapse
Instance Method Details
#[](name) ⇒ Object
16 17 18 |
# File 'lib/portable-hole/association_extensions.rb', line 16 def [](name) @association.owner.get_portable_value(@association.reflection.name, name) end |
#[]=(name, value) ⇒ Object
12 13 14 |
# File 'lib/portable-hole/association_extensions.rb', line 12 def []=(name, value) @association.owner.set_portable_value(@association.reflection.name, name, value) end |
#save ⇒ Object
4 5 6 |
# File 'lib/portable-hole/association_extensions.rb', line 4 def save do_save(false) end |
#save! ⇒ Object
8 9 10 |
# File 'lib/portable-hole/association_extensions.rb', line 8 def save! do_save(true) end |
#valid? ⇒ Boolean
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/portable-hole/association_extensions.rb', line 20 def valid? valid = true proxy_target.each do |thing| thing.model_cache = @association.owner unless thing.valid? thing.errors.each{ |attr, msg| @association.owner.errors.add(@association.reflection.name, msg) } valid = false end end valid end |