Sha256: e29d9b11191ef55d4757041bc376dc29054219674ac8bb3e59241cf696e897bb

Contents?: true

Size: 443 Bytes

Versions: 1

Compression:

Stored size: 443 Bytes

Contents

# +AutoIncrement+
module AutoIncrement
  # +AutoIncrement::ActiveRecord+
  module ActiveRecord
    extend ActiveSupport::Concern
    # +AutoIncrement::ActiveRecord::ClassMethods+
    module ClassMethods
      def auto_increment(column = nil, options = {})
        options.reverse_merge! before: :create

        callback = "before_#{ options[:before]}"

        self.send callback, Incrementor.new(column, options)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
auto_increment-1.4.0 lib/auto_increment/active_record.rb