Sha256: 9dc0c33083faf219e9f8e4806a60f3e1b6a4632187504c4b03df7a6412021628

Contents?: true

Size: 765 Bytes

Versions: 1

Compression:

Stored size: 765 Bytes

Contents

ohm-validations
===============

Validations for Ohm::Model.

Usage
-----

```
class User < Ohm::Model
  include Ohm::Validations

  attribute :name
  attribute :email

  attr :before, :after

  protected

  def validate
    assert_present(:name)
    assert_email(:email)
  end

  def before_validation
    @before = true
  end

  def after_validation
    @after = true
  end
end

user = User.new({})
user.valid? # => false

user.update_attributes(name: "jhon", email: "jhon@doe.com")
user.valid? # => true

user.before # => true
user.after  # => true
```

Check [scrivener][scrivener] project for more information
about the available validations.

Installation
------------

```
$ gem install ohm-validations
```

[scrivener]: https://github.com/soveran/scrivener

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ohm-validations-0.0.1 README.md