Permalink
Browse files

Update the adapter to properly write JS for validates_length_of

  • Loading branch information...
1 parent e6904d1 commit 0d7f3ae8bc3cb22393fd0005ecccd65ea067a38e @jondkinney jondkinney committed Apr 9, 2010
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/live_validations/adapters/livevalidation_dot_com.rb
@@ -21,11 +21,11 @@ class LivevalidationDotCom < LiveValidations::AdapterBase
validates :length do |v, attribute|
if v.callback.options[:minimum]
- v[:validators][attribute]["Length"] = {:minimum => v.callback.options[:minimum], :failureMessage => v.message_for(attribute, :too_short, :count => v.callback.options[:minimum])}
+ v[:validators][attribute]["Length"] = {:minimum => v.callback.options[:minimum], :tooShortMessage => v.message_for(attribute, :too_short, :count => v.callback.options[:minimum])}
end
if v.callback.options[:maximum]
- v[:validators][attribute]["Length"] = {:maximum => v.callback.options[:maximum], :failureMessage => v.message_for(attribute, :too_long, :count => v.callback.options[:maximum])}
+ v[:validators][attribute]["Length"] = {:maximum => v.callback.options[:maximum], :tooLongMessage => v.message_for(attribute, :too_long, :count => v.callback.options[:maximum])}
end
if v.callback.options[:within]
@@ -38,7 +38,7 @@ class LivevalidationDotCom < LiveValidations::AdapterBase
end
if v.callback.options[:is]
- v[:validators][attribute]["Length"] = {:is => v.callback.options[:is]}
+ v[:validators][attribute]["Length"] = {:is => v.callback.options[:is], :wrongLengthMessage => v.message_for(attribute, :wrong_length)}
end
end

0 comments on commit 0d7f3ae

Please sign in to comment.