Class: TicketGroupBundle
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- TicketGroupBundle
- Defined in:
- app/models/ticket_group_bundle.rb
Overview
Schema Information
Table name: ticket_group_bundles
id :bigint not null, primary key
discount_percent :integer
quantity :integer
created_at :datetime not null
updated_at :datetime not null
ticket_group_id :bigint
Indexes
index_ticket_group_bundles_on_ticket_group_id (ticket_group_id)
Class Method Summary collapse
Methods inherited from ApplicationRecord
Class Method Details
.filter_by_quantity(instances, quantity) ⇒ Object
23 24 25 26 |
# File 'app/models/ticket_group_bundle.rb', line 23 def self.filter_by_quantity(instances, quantity) instances.where('quantity <= ?', quantity) .order(quantity: :desc).first.presence || nil end |