rails-style-guide
rails-style-guide copied to clipboard
Description of Single Attribute Validations seems wrong.
The passage on Single Attribute Validations currently reads as follows:
Single-attribute Validations To make validations easy to read, don’t list multiple attributes per validation.
bad
validates :email, :password, presence: true validates :email, length: { maximum: 100 }
good
validates :email, presence: true, length: { maximum: 100 } validates :password, presence: true
If I read things correctly, the rule states that we should not list multiple attributes per validation. In the examples, the good example for email validation listss presence and length (I count two attributes) where the bad example for email validations lists two separate validations - validates presence and validates length.
My understanding is that the rule actually expects to do things like in the bad example.
Shouldn't the examples be turned around here?
Attribute means "model attribute", not "validation". So, it's all good unless I am missing something.