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

Non-model backed sync components #222

Open
ajb opened this issue Mar 4, 2016 · 0 comments
Open

Non-model backed sync components #222

ajb opened this issue Mar 4, 2016 · 0 comments

Comments

@ajb
Copy link
Collaborator

ajb commented Mar 4, 2016

I've run into some instances where I want to sync something that's not tied to a particular resource, such as a count of unread notifications (#191), or a collection of other resources (#112).

It would be interesting if we could remove the hard dependency on an AR model, and do something like:

Views:

<%= sync 'unread_notifications_counter', scope: current_user.id, count: current_user.calc_unread_notifications_count %>
<span class='badge'><%= @count %></span>

Worker:

def perform
  send_notifications # or whatever
  sync_update 'unread_notifications_counter', scope: @user.id, count: @user.calc_unread_notifications_count
end
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

No branches or pull requests

1 participant