Sha256: d4d14c81c83d434aa78b954cd88febbfcccd94a870e83587b38c22a9e8538a34

Contents?: true

Size: 348 Bytes

Versions: 7

Compression:

Stored size: 348 Bytes

Contents

# encoding: utf-8

module DataMapper
  module Aspects
    module Status

      def self.statuses
        %w(draft published archived).freeze
      end

      def self.included(base)
        base.property :status, String, default: ->(r,p) { self.statuses.first }
        base.validates_within :status, set: self.statuses
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
dm-aspects-0.1.0 lib/datamapper/aspects/status.rb
dm-aspects-0.0.6 lib/datamapper/aspects/status.rb
dm-aspects-0.0.5 lib/datamapper/aspects/status.rb
dm-aspects-0.0.4 lib/datamapper/aspects/status.rb
dm-aspects-0.0.3 lib/datamapper/aspects/status.rb
dm-aspects-0.0.2 lib/datamapper/aspects/status.rb
dm-aspects-0.0.1 lib/datamapper/aspects/status.rb