mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Use Ruby safe navigation over Rails try
re: https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/SafeNavigation
This commit is contained in:
parent
d8bd269a64
commit
24396d35c2
11 changed files with 26 additions and 27 deletions
|
|
@ -312,7 +312,7 @@ class Event < ApplicationRecord
|
|||
|
||||
def before_end_of_conference
|
||||
errors
|
||||
.add(:created_at, "can't be after the conference end date!") if program.conference && program.conference.end_date &&
|
||||
.add(:created_at, "can't be after the conference end date!") if program.conference&.end_date &&
|
||||
(Date.today > program.conference.end_date)
|
||||
end
|
||||
|
||||
|
|
@ -324,7 +324,7 @@ class Event < ApplicationRecord
|
|||
# Allow only confirmed tracks that belong to the same program as the event
|
||||
#
|
||||
def valid_track
|
||||
return unless track && track.program && program
|
||||
return unless track&.program && program
|
||||
errors.add(:track, 'is invalid') unless track.confirmed? && track.program == program
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue