Sha256: c90c06b22312dba457f075594b17d22979a01567c9037dee44653f5e11e77c27

Contents?: true

Size: 647 Bytes

Versions: 15

Compression:

Stored size: 647 Bytes

Contents

class Validez

  include DynaModel::Document
  
  string_attr :key
  string_attr :ranger

  string_attr :body
  validates_presence_of :body

  boolean_attr :bool_party, default_value: false
  validates :bool_party, inclusion: { in: [true, false] }

  integer_attr :inteater
  validates :inteater, numericality: { greater_than: 1, less_than: 4 }

  string_attr :superhero

  validate :check_superhero, if: lambda { |v| v.inteater == 3 }

  hash_key :key
  range_key :ranger

  read_provision 4
  write_provision 4

  def check_superhero
    unless self.superhero == "batman"
      self.errors.add(:superhero, 'should be batman')
    end
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
dyna_model-0.0.15 spec/app/models/validez.rb
dyna_model-0.0.14 spec/app/models/validez.rb
dyna_model-0.0.13 spec/app/models/validez.rb
dyna_model-0.0.12 spec/app/models/validez.rb
dyna_model-0.0.11 spec/app/models/validez.rb
dyna_model-0.0.10 spec/app/models/validez.rb
dyna_model-0.0.9 spec/app/models/validez.rb
dyna_model-0.0.8 spec/app/models/validez.rb
dyna_model-0.0.7 spec/app/models/validez.rb
dyna_model-0.0.6 spec/app/models/validez.rb
dyna_model-0.0.5 spec/app/models/validez.rb
dyna_model-0.0.4 spec/app/models/validez.rb
dyna_model-0.0.3 spec/app/models/validez.rb
dyna_model-0.0.2 spec/app/models/validez.rb
dyna_model-0.0.1 spec/app/models/validez.rb