Commit 5f0ea83e7a8592ef87a1b796c9041299b6757484
1 parent
b1c0c2a9
Exists in
master
and in
29 other branches
Fix birth date related I18N problems
Showing
2 changed files
with
4 additions
and
4 deletions
Show diff stats
app/models/person.rb
| ... | ... | @@ -122,7 +122,7 @@ class Person < Profile |
| 122 | 122 | |
| 123 | 123 | validates_each :birth_date do |record,attr,value| |
| 124 | 124 | if value && value.year == 1 |
| 125 | - record.errors.add(attr, _('%{fn} is invalid')) | |
| 125 | + record.errors.add(attr) | |
| 126 | 126 | end |
| 127 | 127 | end |
| 128 | 128 | |
| ... | ... | @@ -135,7 +135,7 @@ class Person < Profile |
| 135 | 135 | self.required_fields.each do |field| |
| 136 | 136 | if self.send(field).blank? |
| 137 | 137 | unless (field == 'custom_area_of_study' && self.area_of_study != 'Others') || (field == 'custom_formation' && self.formation != 'Others') |
| 138 | - self.errors.add(field, _('%{fn} is mandatory')) | |
| 138 | + self.errors.add_on_blank(field) | |
| 139 | 139 | end |
| 140 | 140 | end |
| 141 | 141 | end | ... | ... |
features/edit_profile.feature
| ... | ... | @@ -16,7 +16,7 @@ Feature: edit profile |
| 16 | 16 | And I select "15" |
| 17 | 17 | And I press "Save" |
| 18 | 18 | Then I should see "Birth date is invalid" |
| 19 | - And I should not see "Birth date is mandatory" | |
| 19 | + And I should not see "Birth date can't be blank" | |
| 20 | 20 | |
| 21 | 21 | Scenario: Warn about invalid birth date when required |
| 22 | 22 | Given the following person fields are required fields |
| ... | ... | @@ -28,7 +28,7 @@ Feature: edit profile |
| 28 | 28 | And I select "15" |
| 29 | 29 | And I press "Save" |
| 30 | 30 | Then I should see "Birth date is invalid" |
| 31 | - And I should see "Birth date is mandatory" | |
| 31 | + And I should not see "Birth date can't be blank" | |
| 32 | 32 | |
| 33 | 33 | Scenario: Not warn if birth date is valid when active |
| 34 | 34 | Given the following person fields are active fields | ... | ... |