Skip to content

Commit

Permalink
Added i18n keys for some of the validations.
Browse files Browse the repository at this point in the history
inclusion_of needs some additions in mattmatt-validatable before it can parameterize the i18n message.
  • Loading branch information
roidrage committed Jul 15, 2010
1 parent a96407e commit 163768c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/simply_stored/couch/validations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ def valid?(instance)
def message(instance)
super || "is invalid"
end

def i18n
super || "#{i18n_prefix}.invalid"
end
end

class ValidatesUniquenessOf < ::Validatable::ValidationBase
Expand All @@ -50,6 +54,10 @@ def valid?(instance)
def message(instance)
super || "#{attribute.to_s.try(:humanize) || attribute.to_s} is already taken"
end

def i18n
super || "#{i18n_prefix}.not_unique"
end
end

def validates_inclusion_of(*args)
Expand Down

0 comments on commit 163768c

Please sign in to comment.