Skip to content

Instantly share code, notes, and snippets.

@bleonard
Created December 24, 2016 18:24
Show Gist options
  • Save bleonard/96c014ee26e00365c2d01ba938ea5ee6 to your computer and use it in GitHub Desktop.
Save bleonard/96c014ee26e00365c2d01ba938ea5ee6 to your computer and use it in GitHub Desktop.
class Profile::ContentSubscriber
include ResqueBus::Subscriber
subscribe :post_created
def post_created(attributes)
profile = Profile::Document.find_by(user_id: attributes['post_author_id'])
profile.post_ratings_total = attributes['total_ratings']
profile.post_rating_average = attributes['new_average']
profile.save!
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment