Comments (5)
Hello! We're discovering this gem as we soon want to build the ability to add "Reactions" which are emojis that are tagged to any object like posts or comments similiar to Slack and Github. Indeed, it would be nice to have a semantic dsl for "Reactions". Something like:
user.react_to(post, with: :thumbs_up)
user.react_to(comment, with: 😓 )
This can be implemented along with "magic methods" or as a very specific use case, which I imagine, will be welcomed by the community.
We might be able to contribute to this gem depending on if there is interest and what the scope of work is. Let me know if you think this is worthwhile to add and if we can collaborate on the specification for such.
Thanks!
PS: My company can also consider sponsoring this feature if there was a willing developer able to build it out.
from acts_as_favoritor.
yeah, I think keeping this separate from the model would be a good design choice imo.
Regarding the caching, as mentioned in the readme scores are stored in the database, so it should be a single query. It's just a row in the database, so you can include it in any single query you're building however complex it may be.
from acts_as_favoritor.
Hey, thank you for your proposal! I don't think I fully understand what change you're seeking. From my pov your use case is already covered by
user.favorite(post, scopes: [:reaction_thumbs_up])
All that react_to
would be is a slightly different interface for the same behavior. If you prefer that interface, you can easily build that with a couple of lines of code (it's really just renaming the function and its parameters essentially). Am I missing anything? 🙂
from acts_as_favoritor.
On another note, I'm not too on board with this magic methods change anymore. IMO it is best to have a unified and flexible API. Happy to be convinced of the contrary and read through proposals of how this could be implemented though.
from acts_as_favoritor.
Thanks for getting back. Yea, I suppose it's just a wrapper. I could also imagine view helpers to really create a nice abstraction so reactions are first class and super easy to integrate into an app. Although, I don't know if you want any view layer code in this gem.
Perhaps, we can create a separate gem that depends on this one and adds all the dsl wrapper methods and view layer stuff?
One question I have with this gem, I'm hoping you can help with, is if I'm loading, say, 50 posts into a view, and I want to display the favorite counts for each post, grouped by scope (eg 3 👍 , 5 ❤️ , 1 💯 ), what are the performance considerations here? Can this be done in a single query or a 2nd query? Is this where the cache section of the Readme is useful? Thanks for any guidance on that sort of scenario.
from acts_as_favoritor.
Related Issues (20)
- Allow either a single `scope` or multiple `scopes` to be given
- Release 5.0.0
- Not working with Rails 5.2 HOT 2
- Setup dependabot
- Remove auto merge
- Update readme
- Add issue templates
- Add pull request template
- Add security policy
- Add contributing guidelines
- Add CodeQL
- Stop publishing to GPR
- Release 5.0.1
- Test on Ruby 3
- PG::UndefinedFunction: ERROR: operator does not exist: bigint = uuid HOT 2
- How to check the favorite on react?
- Mysql2::Error: Specified key was too long; max key length is 3072 bytes HOT 1
- favorited? method for a array? HOT 1
- The difference between favoritor_score vs favoritor_total?
- Rails 7.1 throw 'missing keyword: :coder' Error
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_favoritor.