Sha256: c6a52cdfcd131389b5aebcc370d7149af47cc3e19980aa5035b89c254008c8db

Contents?: true

Size: 589 Bytes

Versions: 2

Compression:

Stored size: 589 Bytes

Contents

# -*- encoding : utf-8 -*-
module Mongoid
  module Userstamp
    class Railtie < Rails::Railtie
      ActiveSupport.on_load :action_controller do
        before_filter do |c|
          unless Mongoid::Userstamp.config.user_model.respond_to? :current
            Mongoid::Userstamp.config.user_model.send(
              :include,
              Mongoid::Userstamp::User
            )
          end

          begin
            Mongoid::Userstamp.config.user_model.current = c.send(Mongoid::Userstamp.config.user_reader)
          rescue
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
glebtv_mongoid_userstamp-0.4.1 lib/mongoid/userstamp/railtie.rb
glebtv_mongoid_userstamp-0.4.0 lib/mongoid/userstamp/railtie.rb