Sha256: 755d49c993dc74857ce57c857776146503d2f2293c08e81e074e453efc089be8
Contents?: true
Size: 658 Bytes
Versions: 11
Compression:
Stored size: 658 Bytes
Contents
class BusList < ApplicationRecord validates_presence_of :name, :capacity validates_uniqueness_of :name has_many :questionnaires strip_attributes def full? passengers.count >= capacity end def passengers questionnaires.where("acc_status = 'rsvp_confirmed'").order("last_name ASC") end def schools passengers.joins(:school).map(&:school).uniq end def checked_in_passengers passengers.select(&:checked_in?) end def boarded_passengers passengers.select(&:boarded_bus?) end def captains passengers.where(is_bus_captain: true) end def name_maybe_full full? ? "(full) #{name}" : name end end
Version data entries
11 entries across 11 versions & 1 rubygems