Module: ActsAsTaggableOnMongoid::Taggable::TaggerRelation
- Defined in:
- lib/acts_as_taggable_on_mongoid/taggable/tagger_relation.rb
Overview
Overides of methods from Mongoid::Processing which process attributes for methods like ‘assign_attributes`, `create`, `new`, and `update_attributes`
The need for this override is because the base method splits the order that methods are processed in to process relationships after processing other attributes.
However, tag lists may rely upon values set in relationships - forcing us to process tag lists AFTER relationships have been processed - preventing the need to order attributes (which wouldn’t help anyway because of the way process_attributes works.)
ONLY taggings that have a default and which accept tagger values and which default the tagger based on the taggable object could be affected by other attributes set at the same time as the tag list. Thus only those tag values are delayed until after all other attributes are set.
Instance Method Summary collapse
Instance Method Details
#process_attributes(attrs = nil) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/acts_as_taggable_on_mongoid/taggable/tagger_relation.rb', line 19 def process_attributes(attrs = nil) update_attrs, defaulted_attrs = atom_attributes_without_defaults(attrs) super(update_attrs) defaulted_attrs.each do |key, value| public_send("#{key}=", value) end end |