Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert repeat includes #411

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/acts_as_taggable_on/acts_as_taggable_on/dirty.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module ClassMethods
def initialize_acts_as_taggable_on_dirty
tag_types.map(&:to_s).each do |tags_type|
tag_type = tags_type.to_s.singularize
context_tags = tags_type.to_sym

class_eval <<-RUBY, __FILE__, __LINE__ + 1
def #{tag_type}_list_changed?
Expand All @@ -32,6 +31,11 @@ def #{tag_type}_list_changes

end
end

def acts_as_taggable_on(*args)
super(*args)
initialize_acts_as_taggable_on_dirty
end
end
end
end
6 changes: 4 additions & 2 deletions lib/acts_as_taggable_on/acts_as_taggable_on/related.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ def find_matching_contexts_for(klass, search_context, result_context, options =
end
end

def acts_as_taggable_on(*args)
super(*args)
private

def taggable_on(ordered, *tag_types)
super(ordered, *tag_types)
initialize_acts_as_taggable_on_related
end
end
Expand Down
15 changes: 6 additions & 9 deletions lib/acts_as_taggable_on/taggable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,14 @@ def self.taggable?
end

include ActsAsTaggableOn::Utils
include ActsAsTaggableOn::Taggable::Core
include ActsAsTaggableOn::Taggable::Collection
include ActsAsTaggableOn::Taggable::Cache
include ActsAsTaggableOn::Taggable::Ownership
include ActsAsTaggableOn::Taggable::Related
include ActsAsTaggableOn::Taggable::Dirty
end
end

# each of these add context-specific methods and must be
# called on each call of taggable_on
include ActsAsTaggableOn::Taggable::Core
include ActsAsTaggableOn::Taggable::Collection
include ActsAsTaggableOn::Taggable::Cache
include ActsAsTaggableOn::Taggable::Ownership
include ActsAsTaggableOn::Taggable::Related
include ActsAsTaggableOn::Taggable::Dirty
end

end
Expand Down