Skip to content

Commit

Permalink
Fix a bug: edge case of birthday in the future in seeds.rb, we should…
Browse files Browse the repository at this point in the history
… use Date.current instead of DateTime.current since birthday is a date (see #344)
  • Loading branch information
nflorentin committed May 4, 2022
1 parent 5cffdff commit 5e5822c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## next deploy

- when generating an avoir, the option "by_wallet" is not present anymore if wallet module is off
- Fix a bug: edge case of birthday in the future in seeds.rb, we should use Date.current instead of DateTime.current since birthday is a date (see https://github.com/sleede/fab-manager/issues/344)

## v5.3.13 2022 May 02

Expand Down
2 changes: 1 addition & 1 deletion app/models/statistic_profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ def age
private

def check_birthday_in_past
errors.add(:birthday, I18n.t('statistic_profile.birthday_in_past')) if birthday.present? && birthday > DateTime.current
errors.add(:birthday, I18n.t('statistic_profile.birthday_in_past')) if birthday.present? && birthday > Date.current
end
end
2 changes: 1 addition & 1 deletion db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
admin = User.new(username: 'admin', email: ENV['ADMIN_EMAIL'], password: ENV['ADMIN_PASSWORD'],
password_confirmation: Rails.application.secrets.admin_password, group_id: Group.find_by(slug: 'admins').id,
profile_attributes: { first_name: 'admin', last_name: 'admin', phone: '0123456789' },
statistic_profile_attributes: { gender: true, birthday: DateTime.current })
statistic_profile_attributes: { gender: true, birthday: Date.current })
admin.add_role 'admin'
admin.save!
end
Expand Down

0 comments on commit 5e5822c

Please sign in to comment.