Sha256: 3c83df7f4b9485a50afc39d72fe17770df957c1b6204199f9fd98753ea690273

Contents?: true

Size: 799 Bytes

Versions: 1

Compression:

Stored size: 799 Bytes

Contents

# -*- encoding : utf-8 -*-
module Mongoid
  module Userstamp
    class Config
      attr_writer :user_model
      attr_accessor :user_reader
      attr_accessor :created_column
      attr_accessor :created_column_opts
      attr_accessor :created_accessor
      attr_accessor :updated_column
      attr_accessor :updated_column_opts
      attr_accessor :updated_accessor

      def initialize(&block)
        @user_model = :user
        @user_reader = :current_user
        @created_column = :created_by
        @created_accessor = :creator
        @updated_column = :updated_by
        @updated_accessor = :updater

        instance_eval(&block) if block_given?
      end

      def user_model
        @user_model.to_s.classify.constantize
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongoid_userstamp-0.3.2 lib/mongoid/userstamp/config.rb