Module: ActsAsTaggableOn::Taggable::Core::InstanceMethods
- Defined in:
- lib/acts_as_taggable_on/social_stream.rb
Instance Method Summary collapse
Instance Method Details
#process_dirty_object(context, new_list) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/acts_as_taggable_on/social_stream.rb', line 43 def process_dirty_object(context,new_list) value = new_list.is_a?(Array) ? new_list.join(', ') : new_list attrib = "#{context.to_s.singularize}_list" if changed_attributes.include?(attrib) # The attribute already has an unsaved change. old = changed_attributes[attrib] changed_attributes.delete(attrib) if (old.to_s == value.to_s) else old = tag_list_on(context).to_s changed_attributes[attrib] = old if (old.to_s != value.to_s) end end |
#set_tag_list_on(context, new_list) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/acts_as_taggable_on/social_stream.rb', line 34 def set_tag_list_on(context, new_list) add_custom_context(context) variable_name = "@#{context.to_s.singularize}_list" process_dirty_object(context, new_list) unless custom_contexts.include?(context.to_s) instance_variable_set(variable_name, ActsAsTaggableOn::TagList.from(new_list)) end |