Comments (4)
Just pinging on this question again... My main question is about tags on existing records. Our application is multi-tenant in the same DB. There is an accounts table and a contacts table. The contacts table has an account_id column. If I add acts_as_taggable_tenant :account_id
to the contact model, will all the tags on existing contacts records benefit from this or would I have to delete the tags from each contact and add them back?
from acts-as-taggable-on.
Hello @bradeaton i know this is old post but anyway, our team also use this gem for tagging conversation rooms in our application. There is one heavy query that do aggregates on our model (rooms count by tag). This query can process up to 8 millions row at once so itu is very slow before optimi zed (~30s) and now it becomes ~5s.
My comments on your query is:
- Just select the necessary columns
- Make sure to create multicolumn index that consisted of all columns used in your where clause. include columns that used in your select and join keys
from acts-as-taggable-on.
I faced the almost same problem. It seems the best way is to create a new column on the table and store the cached tag. And query on that table not using these tables. (Ref: https://github.com/mbleigh/acts-as-taggable-on/wiki/Caching
I'm testing with my local, hope this works.
from acts-as-taggable-on.
Another solution is to add a new scope that reproduces the original query, eg
scope :with_tag, lambda {|tag| joins(:taggings).where(taggings: { tag_id: tag.id }) }
and then replace the tagged_with
calls with this scope.
It would be nice to add the option of passing in an actual tag (instead of the name) and then use the query in the scope above.
from acts-as-taggable-on.
Related Issues (20)
- ActiveRecord::UnknownAttributeReference - Dangerous query method HOT 1
- Support for labels through additional columns in tags table?
- Question: Validations of tag length
- ActiveModel::UnknownAttributeError with upsert
- No implicit conversion of nil into String error.
- Ownership does not work with tenancy HOT 2
- How to use cache appropriately? HOT 1
- Still actively maintained? HOT 1
- Support with multiple taggable objects HOT 1
- Errors when trying to execute .count in the result of .tagged_with
- rails 7.1 gemspec issue HOT 3
- Issue on Rails 7.1 upgrade HOT 9
- `tagged_with` adding backslash to tag names when `any: true`
- Applying custom parser on save only
- Adding tags using #tag_ids= breaks when migrating from v5 to v6 HOT 1
- Option to prevent user of inserting malicious text in the tag HOT 1
- New `acts_as_taggable_on:sharded_db:install_initializer` task is broken
- SQL-Query on every update (even without Changes)
- Suggestion for a single-file migration (some indexes were removed)
- Issue on rails 7.2 update HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from acts-as-taggable-on.