Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ActionPusher customizations - Higher level customization of the ActionPusher gem https://github.com/agoragames/action_pusher
# NOTE: this architecture hinges on the channels being specific to the user
# this allows us to know what permissions context to render templates under
# seeing as how this may need to be run in a background task without a "current user" context
# so the "current user" is really the recipient of the notification
class ApplicationPusher < ActionPusher::Base
attr_accessor :channel, :event, :current_user
include ActionController::HideActions
include Authorization::AuthorizationInController
helper Authorization::AuthorizationHelper
helper_method :current_user
default_url_options[:host] = Recognize::Application.config.host
def initialize(channel, event, user)
@channel, @event, @current_user = channel, event, user
return self
end
def push!
Pushable.push(channel, event, self.push_object) if Rails.configuration.send_push_notifications
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.