Module: SweetNotifications::Railtie
- Extended by:
- Railtie
- Included in:
- SweetNotifications, Railtie
- Defined in:
- lib/sweet_notifications/railtie.rb
Overview
Rails Railtie integration
Instance Method Summary collapse
-
#initialize_rails(name, log_subscriber, controller_runtime) ⇒ Object
Attach LogSubscriber and ControllerRuntime to a notifications namespace.
-
#railtie(name, log_subscriber, controller_runtime) ⇒ Rails::Railtie
Create a Railtie for LogSubscriber and ControllerRuntime mixin.
Instance Method Details
#initialize_rails(name, log_subscriber, controller_runtime) ⇒ Object
Attach LogSubscriber and ControllerRuntime to a notifications namespace
12 13 14 15 16 17 |
# File 'lib/sweet_notifications/railtie.rb', line 12 def initialize_rails(name, log_subscriber, controller_runtime) log_subscriber.attach_to name.to_sym ActiveSupport.on_load(:action_controller) do include controller_runtime end end |
#railtie(name, log_subscriber, controller_runtime) ⇒ Rails::Railtie
Create a Railtie for LogSubscriber and ControllerRuntime mixin
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/sweet_notifications/railtie.rb', line 25 def railtie(name, log_subscriber, controller_runtime) Class.new(Rails::Railtie) do railtie_name name initializer "#{name}.notifications" do SweetNotifications::Railtie.initialize_rails(name, log_subscriber, controller_runtime) end end end |