Sha256: 5d6105e3e179755e7165704819f0b26a3c41dd2f03640a2e0b97c332892549c4
Contents?: true
Size: 534 Bytes
Versions: 15
Compression:
Stored size: 534 Bytes
Contents
class BusList < ApplicationRecord validates_presence_of :name, :capacity validates_uniqueness_of :name has_many :schools strip_attributes def full? passengers.count >= capacity end def passengers Questionnaire.joins(:school).where("schools.bus_list_id = '#{id}' AND acc_status = 'rsvp_confirmed' AND riding_bus = true").order("schools.name ASC, last_name ASC") end def checked_in_passengers passengers.select(&:checked_in?) end def captains passengers.where(is_bus_captain: true) end end
Version data entries
15 entries across 15 versions & 1 rubygems