Skip to content

Instantly share code, notes, and snippets.

@jdelStrother
Created April 25, 2011 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdelStrother/941398 to your computer and use it in GitHub Desktop.
Save jdelStrother/941398 to your computer and use it in GitHub Desktop.
diff --git a/lib/acts_as_taggable_on/acts_as_taggable_on/core.rb b/lib/acts_as_taggable_on/acts_as_taggable_on/core.rb
index 5e9bdaa..fc51c2d 100644
--- a/lib/acts_as_taggable_on/acts_as_taggable_on/core.rb
+++ b/lib/acts_as_taggable_on/acts_as_taggable_on/core.rb
@@ -197,20 +197,21 @@ module ActsAsTaggableOn::Taggable
else
scope = scope.group("#{ActsAsTaggableOn::Tag.table_name}.#{ActsAsTaggableOn::Tag.primary_key}")
end
scope.all
end
##
# Returns all tags that are not owned of a given context
def tags_on(context)
+ return [] if new_record?
base_tags.where(["#{ActsAsTaggableOn::Tagging.table_name}.context = ? AND #{ActsAsTaggableOn::Tagging.table_name}.tagger_id IS NULL", context.to_s]).all
end
def set_tag_list_on(context, new_list)
add_custom_context(context)
variable_name = "@#{context.to_s.singularize}_list"
instance_variable_set(variable_name, ActsAsTaggableOn::TagList.from(new_list))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment