欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

ruby一些类加载方式

程序员文章站 2022-07-12 20:30:18
...
require_dependency 'order/scopes'


RailsLog::ControllerSubscriber.attach_to :action_controller
RailsLog::MailerSubscriber.attach_to :action_mailer


helper_method :current_contact, :current_cart_items, :current_currency


require 'active_support/configurable'
module RailsLog
  include ActiveSupport::Configurable

  configure do |config|
    config.ignore_exception = [
      'ActionController::UnknownFormat'
    ]
    config.constraint = -> (req){ User.find_by(id: req.env['rack.session']['user_id'])&.admin? }
  end

end

上一篇: 外贸加价算法

下一篇: 程序员的静