Sha256: 89c31f9d156e6ae2192854976bdce5bc98e50cab3a28cc0c9c46a77447a1442a

Contents?: true

Size: 657 Bytes

Versions: 10

Compression:

Stored size: 657 Bytes

Contents

module VestalVersions
  # Simply adds a flag to determine whether a model class if versioned.
  module Versioned
    extend ActiveSupport::Concern

    # Overrides the +versioned+ method to first define the +versioned?+ class method before
    # deferring to the original +versioned+.
    module ClassMethods
      def versioned(*args)
        super(*args)

        class << self
          def versioned?
            true
          end
        end
      end

      # For all ActiveRecord::Base models that do not call the +versioned+ method, the +versioned?+
      # method will return false.
      def versioned?
        false
      end
    end

  end
end

Version data entries

10 entries across 10 versions & 6 rubygems

Version Path
houston-vestal_versions-3.0.0 lib/vestal_versions/versioned.rb
houston-vestal_versions-2.0.1 lib/vestal_versions/versioned.rb
houston-vestal_versions-2.0.0 lib/vestal_versions/versioned.rb
vestal_versions-2.0.0 lib/vestal_versions/versioned.rb
mil_vestal_versions-1.2.6 lib/vestal_versions/versioned.rb
geothird_vestal_versions-1.2.5 lib/vestal_versions/versioned.rb
geothird_vestal_versions-1.2.4 lib/vestal_versions/versioned.rb
geothird_vestal_versions-1.2.3 lib/vestal_versions/versioned.rb
set_vestal_versions-1.2.2 lib/vestal_versions/versioned.rb
razenha-vestal_versions-1.2.2 lib/vestal_versions/versioned.rb