Giter VIP home page Giter VIP logo

Comments (5)

synth avatar synth commented on May 31, 2024 1

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.

jonhue avatar jonhue commented on May 31, 2024 1

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.

jonhue avatar jonhue commented on May 31, 2024

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.

jonhue avatar jonhue commented on May 31, 2024

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.

synth avatar synth commented on May 31, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.