зеркало из
https://github.com/glebtv/telegram-bot.git
synced 2026-08-28 15:26:18 +03:00
* Update rubopcop [WIP] * Further rubocop fixes * Fix rubocop-rails cops * Fix spec * Disable rubocop suggestions * Run rubocop in github actions rather than in codeclimate
38 строки
1.1 KiB
Ruby
38 строки
1.1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
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.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 if options.session_store
|
|
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
|