Sha256: d4c2242fa77451610cf385ad15b17716caa3f389407ed41560290225b2b6ff6b

Contents?: true

Size: 467 Bytes

Versions: 1

Compression:

Stored size: 467 Bytes

Contents

module Mongoid
  module Userstamps
    class Railtie < Rails::Railtie
      # Set current_user from controller reader method
      ActiveSupport.on_load :action_controller do
        before_action do |c|
          Mongoid::Userstamps::Config.user_classes.each do |user_class|
            begin
              user_class.current = c.public_send(user_class.userstamps_user.reader)
            rescue
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongoid-userstamps-3.2.1 lib/mongoid/userstamps/railtie.rb