1
0
зеркало из https://github.com/glebtv/telegram-bot.git synced 2026-09-07 11:25:52 +03:00
Этот коммит содержится в:
Max Melentiev
2016-02-22 22:53:59 +06:00
Коммит 37a63f7b23
29 изменённых файлов: 1333 добавлений и 0 удалений

33
lib/telegram/bot/railtie.rb Обычный файл
Просмотреть файл

@@ -0,0 +1,33 @@
require 'telegram/bot/routes_helper'
module Telegram
class 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
end
end
initializer 'telegram.bot.updates_controller.add_ar_runtime' do
ActiveSupport.on_load('telegram.bot.updates_controller') do
if defined?(ActiveRecord::Railties::ControllerRuntime)
include ActiveRecord::Railties::ControllerRuntime
end
end
end
end
end
end