class Decidim::Meetings::Admin::ValidateRegistrationCodeForm

This class holds a Form to validate registration codes from Decidim’s admin panel.

def meeting

def meeting
  @meeting ||= context[:meeting]
end

def registration

def registration
  @registration ||= meeting.registrations.find_by(code: code, validated_at: nil)
end

def registration_exists

def registration_exists
  return unless registration.nil?
  errors.add(
    :code,
    I18n.t("registrations.validate_registration_code.invalid", scope: "decidim.meetings.admin")
  )
end