Sha256: a1543296ffe02169a925f0ab4c22be6b23f6303648fd8f0114d88ab80c6e85cd

Contents?: true

Size: 437 Bytes

Versions: 4

Compression:

Stored size: 437 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]}"

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
auto_increment-1.5.2 lib/auto_increment/active_record.rb
auto_increment-1.5.1 lib/auto_increment/active_record.rb
auto_increment-1.5.0 lib/auto_increment/active_record.rb
auto_increment-1.4.1 lib/auto_increment/active_record.rb