Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
ActionPusher customizations - Higher level customization of the ActionPusher gem
# 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] =
def initialize(channel, event, user)
@channel, @event, @current_user = channel, event, user
return self
def push!
Pushable.push(channel, event, self.push_object) if Rails.configuration.send_push_notifications
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment