-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changing error message when setting pricing rules #2069
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add test(s) ensuring that it responds with the right error messages when it is appropriate
app/models/pricing_rule.rb
Outdated
end | ||
|
||
if max && max < min | ||
errors.add(:max, "'To' value cannot be less than your 'From' value.") | ||
errors.add(:max, :to_value_cannot_be_less_that_from_value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
errors.add(:max, :to_value_cannot_be_less_that_from_value) | |
errors.add(:max, :min_max_mismatch) |
config/locales/en.yml
Outdated
min: | ||
overlap_message: "The 'From' value must be greater than the 'To' values of other existing rules" | ||
max: | ||
to_value_cannot_be_less_that_from_value: "'To' value cannot be less than your 'From' value." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to_value_cannot_be_less_that_from_value: "'To' value cannot be less than your 'From' value." | |
min_max_mismatch: "'To' value cannot be less than your 'From' value." |
app/models/pricing_rule.rb
Outdated
@@ -88,11 +88,11 @@ def range_overlap | |||
end | |||
|
|||
if overlap #rules.count > 0 | |||
errors.add(:min, "'From' value cannot be less than 'To' values of current rules.") | |||
errors.add(:min, :overlap_message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
errors.add(:min, :overlap_message) | |
errors.add(:min, :overlap) |
config/locales/en.yml
Outdated
pricing_rule: | ||
attributes: | ||
min: | ||
overlap_message: "The 'From' value must be greater than the 'To' values of other existing rules" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overlap_message: "The 'From' value must be greater than the 'To' values of other existing rules" | |
overlap: "The 'From' value must be greater than the 'To' values of other existing rules" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 💪 🥇 🎉
What this PR does / why we need it:
changing the error message when setting pricing rules
Which issue(s) this PR fixes
https://issues.redhat.com/browse/THREESCALE-5565
Verification steps