Sha256: a23efeda98ba214ce33a540e8b83ad5c0aba0d8baca7fb371bc4db837e8beb1f
Contents?: true
Size: 1.32 KB
Versions: 1
Compression:
Stored size: 1.32 KB
Contents
module Alondra class PushController include ActiveSupport::Configurable include AbstractController::Logger include AbstractController::Rendering include AbstractController::Helpers include AbstractController::Translation include AbstractController::AssetPaths include AbstractController::ViewPaths attr_accessor :channel_names def initialize(context, to) @channel_names = Channel.names_for(to) self.class.view_paths = ActionController::Base.view_paths copy_instance_variables_from(context) end def render_push(options) if EM.reactor_thread? Rails.logger.warn('Your are rendering a view from the Event Machine reactor thread') Rails.logger.warn('Rendering a view is a possibly blocking operation, so be careful') end message_content = render_to_string(*options) msg = Message.new(message_content, channel_names) msg.enqueue end def _prefixes ['application'] end def view_paths @view_paths ||= ApplicationController.send '_view_paths' end def action_name 'push' end private def copy_instance_variables_from(context) context.instance_variables.each do |var| value = context.instance_variable_get(var) instance_variable_set(var, value) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
alondra-0.0.3 | lib/alondra/push_controller.rb |