Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Updates usage example
  • Loading branch information
Luis Alfredo Lorenzo committed Jul 8, 2015
1 parent efdf903 commit 1c20a73
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Resource
attr_accessor :password

validate :password_length
validate :blank_password

def initialize(password)
@password = password
Expand All @@ -43,6 +44,10 @@ class Resource
def password_length
warnings.add(:password, "min length should be 5") if password.length < 5
end

def blank_password
errors.add(:password, 'should not be blank') if password.length == 0
end
end

resource = Resource.new('safe')
Expand Down

0 comments on commit 1c20a73

Please sign in to comment.