Sha256: 052d1667a9e3153d1231a69404ddcbb46779c367711f8625ffdd041dcbcf2fd4

Contents?: true

Size: 540 Bytes

Versions: 1

Compression:

Stored size: 540 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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongoid_userstamp-0.3.0 lib/mongoid/userstamp/railtie.rb