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

ActiveRecord 4.1 compatibility (take 2) #446

Merged
merged 3 commits into from
Dec 27, 2013
Merged

Conversation

eagletmt
Copy link
Contributor

Fixes #435.
I override count() with count(:all) by extending scopes.
I think it doesn't pose any compatibility issues to existing codes that uses acts-as-taggable-on.

ref: #436

@@ -90,7 +90,7 @@ def all_tags(options = {})
tagging_scope = tagging_scope.where("#{ActsAsTaggableOn::Tagging.table_name}.taggable_id IN(#{safe_to_sql(select(scoped_select))})").group(group_columns)

tag_scope = tag_scope.joins("JOIN (#{safe_to_sql(tagging_scope)}) AS #{ActsAsTaggableOn::Tagging.table_name} ON #{ActsAsTaggableOn::Tagging.table_name}.tag_id = #{ActsAsTaggableOn::Tag.table_name}.id")
tag_scope
tag_scope.extending(CalculationMethods)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will break the method cache by extending the association proxy whenever this method is called. Couldn't we just monkey patch ActsAsTaggableOn::Tag or extend its association as per http://guides.rubyonrails.org/association_basics.html#association-extensions ?

@bf4 bf4 merged commit a2c996f into mbleigh:master Dec 27, 2013
@bf4
Copy link
Collaborator

bf4 commented Dec 27, 2013

I fiddled with this a bunch and couldn't come up with anything else that worked.. weird

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incompatibility with activerecord 4.1.0.beta1
2 participants