Sha256: 99f56ac4b117cc254c4c4e9289bbed36712d6cb075440bb37ba2f367ef1215fe

Contents?: true

Size: 546 Bytes

Versions: 2

Compression:

Stored size: 546 Bytes

Contents

module VestalVersions
  # Ties into the existing ActiveRecord::Base#reload method to ensure that version information
  # is properly reset.
  module Reload
    extend ActiveSupport::Concern

    # Adds instance methods into ActiveRecord::Base to tap into the +reload+ method.
    module InstanceMethods
      # Overrides ActiveRecord::Base#reload, resetting the instance-variable-cached version number
      # before performing the original +reload+ method.
      def reload(*args)
        reset_version
        super
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
set_vestal_versions-1.2.2 lib/vestal_versions/reload.rb
razenha-vestal_versions-1.2.2 lib/vestal_versions/reload.rb