Sha256: 701f9373384255d4346f1b26aac5104986a051a9623dcbd27c28efaf903619c9

Contents?: true

Size: 501 Bytes

Versions: 6

Compression:

Stored size: 501 Bytes

Contents

require_dependency "renalware"

module Renalware
  module HD
    module HasSchedule
      extend ActiveSupport::Concern

      included do
        extend Enumerize

        enumerize :schedule,
          in: I18n.t(:schedule, scope: "enumerize.#{model_name.i18n_key}", cascade: true).keys

        validates :other_schedule, presence: true, if: :other_schedule_required?
      end

      private

      def other_schedule_required?
        schedule.try(:text) =~ /specify/
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.beta9 app/models/concerns/renalware/hd/has_schedule.rb
renalware-core-2.0.0.pre.beta8 app/models/concerns/renalware/hd/has_schedule.rb
renalware-core-2.0.0.pre.beta7 app/models/concerns/renalware/hd/has_schedule.rb
renalware-core-2.0.0.pre.beta6 app/models/concerns/renalware/hd/has_schedule.rb
renalware-core-2.0.0.pre.beta5 app/models/concerns/renalware/hd/has_schedule.rb
renalware-core-2.0.0.pre.beta4 app/models/concerns/renalware/hd/has_schedule.rb