Sha256: 72a419787802d87615e280dacac4edcbcc01079a1829386f01ed84ec1a42ad28

Contents?: true

Size: 369 Bytes

Versions: 3

Compression:

Stored size: 369 Bytes

Contents

module MassiveRecord
  module ORM
    module DefaultId
      extend ActiveSupport::Concern

      included do
        before_create :ensure_record_has_id, :if => :set_id_from_factory_before_create
      end


      module InstanceMethods
        private

        def ensure_record_has_id
          self.id = next_id if id.blank?
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
massive_record-0.2.2 lib/massive_record/orm/default_id.rb
massive_record-0.2.2.rc2 lib/massive_record/orm/default_id.rb
massive_record-0.2.2.rc1 lib/massive_record/orm/default_id.rb