Module Sequel::Plugins::NestedAttributes::InstanceMethods
In: lib/sequel/plugins/nested_attributes.rb

Methods

Public Instance methods

Set the nested attributes for the given association. obj should be an enumerable of multiple objects for plural associations. The opts hash can be used to override any of the default options set by the class-level nested_attributes call.

[Source]

     # File lib/sequel/plugins/nested_attributes.rb, line 141
141:         def set_nested_attributes(assoc, obj, opts=OPTS)
142:           raise(Error, "no association named #{assoc} for #{model.inspect}") unless ref = model.association_reflection(assoc)
143:           raise(Error, "nested attributes are not enabled for association #{assoc} for #{model.inspect}") unless meta = ref[:nested_attributes]
144:           meta = Hash[meta].merge!(opts)
145:           meta[:reflection] = ref
146:           if ref.returns_array?
147:             nested_attributes_list_setter(meta, obj)
148:           else
149:             nested_attributes_setter(meta, obj)
150:           end
151:         end

[Validate]