Fix failing validation in Registration

In the conference is not set, validation that the call for paper is
accepted breaks. This made the conference association test failing.
This commit is contained in:
Ana María Martínez Gómez 2019-03-27 10:19:01 +01:00
parent 998dc0927b
commit ca574ae2af
No known key found for this signature in database
GPG key ID: EACB9B4BC80C0347

View file

@ -31,7 +31,7 @@ class Registration < ApplicationRecord
validate :registration_to_events_only_if_present
validates :accepted_code_of_conduct, acceptance: {
if: -> { conference.code_of_conduct.present? }
if: -> { conference.try(:code_of_conduct).present? }
}
after_create :set_week, :subscribe_to_conference, :send_registration_mail