Multiple Validation Errors for the same Attribute
barriault opened this issue · 1 comments
barriault commented
ruby 2.3.3
rails 4.2.5
class Party < ActiveRecord::Base
actable
validates :name, presence: true
end
class Client < ActiveRecord::Base
acts_as :party, dependent: :destroy
validates :preferred_phone_number, presence: true
end
When I create a client with invalid attributes, my errors hash look like this:
@messages={
:name=>["can't be blank", "can't be blank", "can't be blank"],
:preferred_phone_number=>["can't be blank", "can't be blank"],
:"actable.name"=>["can't be blank"],
:"actable.preferred_phone_number"=>["can't be blank"]
}
This results in my errors on the form looking something like this:
10 errors prohibited this client from being saved:
- Name can't be blank
- Name can't be blank
- Name can't be blank
- Preferred phone number can't be blank
- Preferred phone number can't be blank
- Actable name can't be blank
- Actable preferred phone number can't be blank
This makes no sense . . .
manuelmeurer commented
Should be fixed in v2.3.0.