Sha256: 28d9cd96e181195e10c83bf3380c2cc8fb5cd2116333baf618c4ab22f5c7d5ef

Contents?: true

Size: 462 Bytes

Versions: 12

Compression:

Stored size: 462 Bytes

Contents

$LOAD_PATH.unshift '../lib'
require 'memory_record'

class Foo
  include MemoryRecord
  memory_record [
    {name: 'alice'},
    {name: 'bob'},
  ]
end

require 'active_model'

class Foo
  include ActiveModel::Validations
  validates :name, length: { maximum: 3 }
end

Foo.collect(&:valid?)           # => [false, true]

foo = Foo.first
foo.valid?                     # => false
foo.errors.full_messages       # => ["Name is too long (maximum is 3 characters)"]

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
memory_record-0.0.20 examples/0200_with_active_model_validation.rb
memory_record-0.0.19 examples/0200_with_active_model_validation.rb
memory_record-0.0.18 examples/0200_with_active_model_validation.rb
memory_record-0.0.17 examples/0200_with_active_model_validation.rb
memory_record-0.0.15 examples/0200_with_active_model_validation.rb
memory_record-0.0.14 examples/0200_with_active_model_validation.rb
memory_record-0.0.13 examples/0200_with_active_model_validation.rb
memory_record-0.0.12 examples/0200_with_active_model_validation.rb
memory_record-0.0.11 examples/0200_with_active_model_validation.rb
memory_record-0.0.10 examples/0200_with_active_model_validation.rb
memory_record-0.0.9 examples/0200_with_active_model_validation.rb
memory_record-0.0.8 examples/0200_with_active_model_validation.rb