module ActsAsTaggableOn::Taggable::Core::InstanceMethods

Public Instance Methods

process_dirty_object(context,new_list) click to toggle source
# 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) click to toggle source
# 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