Validation in Rails: validates_numericality_of :amount, :only_integer => true,
:greater_than => -1 doesn't work because of the :only_integer
--------------------------------------------------------------------------------------------------------------------------------------------
Key: JRUBY-4261
URL: http://jira.codehaus.org/browse/JRUBY-4261
Project: JRuby
Issue Type: Bug
Affects Versions: JRuby 1.4
Environment: Mac jruby 1.4.0 (ruby 1.8.7 patchlevel 174) (2009-11-02
69fbfa3) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_15) [x86_64-java]
Reporter: Helmut Juskewycz
Assignee: Thomas E Enebo
Priority: Minor
I am in the middle of switching to JRuby with an application and some tests
failed, although, in Ruby not.
The problem is the :only_integer => true validation option. In Ruby the
validation works with the option and in JRuby not. When I remove the option,
all tests pass in JRuby.
Here is a code snippet from Rails that causes the problem
...
if configuration[:only_integer]
unless raw_value.to_s =~ /\A[+-]?\d+\Z/
record.errors.add(attr_name, :not_a_number, :value => raw_value, :default
=> configuration[:message])
next
end
raw_value = raw_value.to_i
else
...
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email