This project is archived and is in readonly mode.
ActiveRecord.validators broken in 3.0b4
Reported by Ron | June 9th, 2010 @ 07:12 AM | in 3.0.2
Create a new rails app. Add two models each with validations
(called say User and Order).
class User < ActiveRecord::Base
validates :login, :presence => true, :length => {:minimum => 3, :maximum => 10}, :uniqueness => true
validates :password, :presence => true, :confirmation => true
end
class Order < ActiveRecord::Base
validates :name, :presence => true, :length => {:minimum => 3, :maximum => 100}
validates :price, :numericality => true
end
In rails console,
ruby-head > User.validators.size
=> 5
ruby-head > Order.validators.size
=> 8
ruby-head > User.validators.size
=> 8
ruby-head > User.validators_on(:price)
=> [#<ActiveModel::Validations::NumericalityValidator:0x00000106abc230 @attributes=[:price], @options={:only_integer=>false, :allow_nil=>false}>]
It seems that all validators are being added to some single global
cache instead of a per model cache.Comments and changes to this ticket
-
DHH June 9th, 2010 @ 05:15 PM
- Milestone cleared.
- State changed from new to open
- Assigned user set to Michael Koziarski
-
Neeraj Singh June 10th, 2010 @ 04:11 AM
- Tag set to 3.x, activerecord, patch
Attaching a patch with test.
-
Repository June 10th, 2010 @ 04:51 PM
- State changed from open to resolved
(from [e11bb95d56ed77b10d54d9dfe5a3cc4aa48b3a61]) Validators should at model level and not at AR:Base level [Closes #4804]
[#4804 state:resolved]
Signed-off-by: David Heinemeier Hansson david@loudthinking.com
http://github.com/rails/rails/commit/e11bb95d56ed77b10d54d9dfe5a3cc... -
Repository June 10th, 2010 @ 04:51 PM
- State changed from resolved to committed
(from [e11bb95d56ed77b10d54d9dfe5a3cc4aa48b3a61]) Validators should at model level and not at AR:Base level [Closes #4804]
[#4804 state:resolved]
Signed-off-by: David Heinemeier Hansson david@loudthinking.com
http://github.com/rails/rails/commit/e11bb95d56ed77b10d54d9dfe5a3cc... -
Repository June 13th, 2010 @ 02:47 AM
(from [d67549306567b219089f2355fe432d31d0ebf8a1]) Revert "Validators should at model level and not at AR:Base level [Closes #4804]"
This reverts commit e11bb95d56ed77b10d54d9dfe5a3cc4aa48b3a61.
http://github.com/rails/rails/commit/d67549306567b219089f2355fe432d... -
Repository June 13th, 2010 @ 02:48 AM
(from [a087bc85fd24e7261ce6a6f63ffa2dbd49db567d]) Revert "Revert "Validators should at model level and not at AR:Base level [Closes #4804]""
This reverts commit d67549306567b219089f2355fe432d31d0ebf8a1.
http://github.com/rails/rails/commit/a087bc85fd24e7261ce6a6f63ffa2d...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Tags
Referenced by
- 4804 ActiveRecord.validators broken in 3.0b4 (from [e11bb95d56ed77b10d54d9dfe5a3cc4aa48b3a61]) Validat...
- 4804 ActiveRecord.validators broken in 3.0b4 [#4804 state:resolved]
- 4804 ActiveRecord.validators broken in 3.0b4 (from [e11bb95d56ed77b10d54d9dfe5a3cc4aa48b3a61]) Validat...
- 4804 ActiveRecord.validators broken in 3.0b4 [#4804 state:resolved]
- 4804 ActiveRecord.validators broken in 3.0b4 (from [d67549306567b219089f2355fe432d31d0ebf8a1]) Revert ...
- 4804 ActiveRecord.validators broken in 3.0b4 (from [a087bc85fd24e7261ce6a6f63ffa2dbd49db567d]) Revert ...