Don't update user if it doesn't exist

This commit is contained in:
Eugene Burmakin 2024-09-06 22:54:53 +02:00
parent ce85e08ed8
commit 98506a3a4f
3 changed files with 10 additions and 3 deletions

View file

@ -1 +1 @@
0.13.3
0.13.4

View file

@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.13.4] — 2024-09-06
### Fixed
- Fixed a bug preventing the application from starting, when there is no users in the database but a data migration tries to update one.
## [0.13.3] — 2024-09-06
### Added

View file

@ -3,11 +3,11 @@
class MakeFirstUserAdmin < ActiveRecord::Migration[7.1]
def up
user = User.first
user.update!(admin: true)
user&.update!(admin: true)
end
def down
user = User.first
user.update!(admin: false)
user&.update!(admin: false)
end
end