Created
March 29, 2019 09:40
-
-
Save knoxjeffrey/eb43ea196b4973fd40e4ac1efc2374a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
# Members module | |
module Members | |
# Charters module | |
module Charters | |
# JoinedUpForm class | |
class JoinedUpForm < CharterFormBase | |
ATTRS = %i[ | |
progression_to_service progression_to_service_evidence | |
progression_to_service_ind past_current_partnerships | |
past_current_partnerships_evidence past_current_partnerships_ind | |
].freeze | |
attr_accessor(*ATTRS) | |
validates :progression_to_service, :past_current_partnerships, | |
presence: true | |
validates_length_of :progression_to_service, :past_current_partnerships, | |
maximum: 500 | |
validates_inclusion_of :progression_to_service_evidence, | |
:past_current_partnerships_evidence, | |
in: [true, false], message: "can't be blank" | |
validates :progression_to_service_ind, | |
presence: true, | |
if: :progression_to_service_evidence? | |
validates :past_current_partnerships_ind, | |
presence: true, | |
if: :past_current_partnerships_evidence? | |
private | |
def progression_to_service_evidence? | |
progression_to_service_evidence == true | |
end | |
def past_current_partnerships_evidence? | |
past_current_partnerships_evidence == true | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment