Sha256: 645ce4ccdd49eaece54f5150507f81256694b77a24c72a629057daa93b4da7d0

Contents?: true

Size: 1.08 KB

Versions: 19

Compression:

Stored size: 1.08 KB

Contents

require 'telegram/bot/routes_helper'

module Telegram
  module Bot
    class Railtie < Rails::Railtie
      config.telegram_updates_controller = ActiveSupport::OrderedOptions.new

      rake_tasks do
        load 'tasks/telegram-bot.rake'
      end

      config.before_initialize do
        ::ActionDispatch::Routing::Mapper.send(:include, RoutesHelper)
      end

      initializer 'telegram.bot.updates_controller.set_config' do |app|
        options = app.config.telegram_updates_controller

        ActiveSupport.on_load('telegram.bot.updates_controller') do
          self.logger = options.logger || Rails.logger
          self.session_store = options.session_store || Rails.cache
        end
      end

      initializer 'telegram.bot.updates_controller.add_ar_runtime' do
        ActiveSupport.on_load('telegram.bot.updates_controller') do
          if defined?(ActiveRecord::Railties::ControllerRuntime)
            prepend ActiveRecord::Railties::ControllerRuntime
            extend ActiveRecord::Railties::ControllerRuntime::ClassMethods
          end
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
telegram-bot-0.12.0 lib/telegram/bot/railtie.rb
telegram-bot-0.11.3 lib/telegram/bot/railtie.rb
telegram-bot-0.11.2 lib/telegram/bot/railtie.rb
telegram-bot-0.11.1 lib/telegram/bot/railtie.rb
telegram-bot-0.11.0 lib/telegram/bot/railtie.rb
telegram-bot-0.10.2 lib/telegram/bot/railtie.rb
telegram-bot-0.10.1 lib/telegram/bot/railtie.rb
telegram-bot-0.10.0 lib/telegram/bot/railtie.rb
telegram-bot-0.9.0 lib/telegram/bot/railtie.rb
telegram-bot-0.9.0.alpha2 lib/telegram/bot/railtie.rb
telegram-bot-0.9.0.alpha1 lib/telegram/bot/railtie.rb
telegram-bot-0.8.0 lib/telegram/bot/railtie.rb
telegram-bot-0.7.4 lib/telegram/bot/railtie.rb
telegram-bot-0.7.3 lib/telegram/bot/railtie.rb
telegram-bot-0.7.2 lib/telegram/bot/railtie.rb
telegram-bot-0.6.0 lib/telegram/bot/railtie.rb
telegram-bot-0.5.0 lib/telegram/bot/railtie.rb
telegram-bot-0.4.2 lib/telegram/bot/railtie.rb
telegram-bot-0.4.1 lib/telegram/bot/railtie.rb