Sha256: 8d6a1b3e7f630c109652dede4c5f114eb8505dd9b80fc456e5365cfb5db4de4e

Contents?: true

Size: 724 Bytes

Versions: 27

Compression:

Stored size: 724 Bytes

Contents

# frozen_string_literal: true

# Form object to select a # of tickets on the EventRegistration form

module Effective
  class EventTicketSelection < ActiveRecord::Base
    self.table_name = (EffectiveEvents.event_ticket_selections_table_name || :event_ticket_selections).to_s

    belongs_to :event_registration, polymorphic: true
    belongs_to :event_ticket

    effective_resource do
      quantity        :integer

      timestamps
    end

    scope :sorted, -> { order(:id) }
    scope :deep, -> { includes(:event_registration, :event_ticket) }

    validates :quantity, numericality: { greater_than_or_equal_to: 0 }

    def to_s
      persisted? ? "#{quantity}x #{event_ticket}": model_name.human
    end

  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
effective_events-2.29.1 app/models/effective/event_ticket_selection.rb
effective_events-2.29.0 app/models/effective/event_ticket_selection.rb
effective_events-2.28.3 app/models/effective/event_ticket_selection.rb
effective_events-2.28.2 app/models/effective/event_ticket_selection.rb
effective_events-2.28.1 app/models/effective/event_ticket_selection.rb
effective_events-2.28.0 app/models/effective/event_ticket_selection.rb
effective_events-2.27.0 app/models/effective/event_ticket_selection.rb
effective_events-2.26.0 app/models/effective/event_ticket_selection.rb
effective_events-2.25.1 app/models/effective/event_ticket_selection.rb
effective_events-2.25.0 app/models/effective/event_ticket_selection.rb
effective_events-0.24.0 app/models/effective/event_ticket_selection.rb
effective_events-0.23.1 app/models/effective/event_ticket_selection.rb
effective_events-0.23.0 app/models/effective/event_ticket_selection.rb
effective_events-0.22.2 app/models/effective/event_ticket_selection.rb
effective_events-0.22.1 app/models/effective/event_ticket_selection.rb
effective_events-0.22.0 app/models/effective/event_ticket_selection.rb
effective_events-0.21.3 app/models/effective/event_ticket_selection.rb
effective_events-0.21.2 app/models/effective/event_ticket_selection.rb
effective_events-0.21.1 app/models/effective/event_ticket_selection.rb
effective_events-0.21.0 app/models/effective/event_ticket_selection.rb