Sha256: 13d563a133e3ea4e2c7d7ab8cd80699ec9d8b9a5657bbcde2102666d233b62ad

Contents?: true

Size: 651 Bytes

Versions: 15

Compression:

Stored size: 651 Bytes

Contents

class School < ApplicationRecord
  validates_presence_of :name

  validates_uniqueness_of :name

  strip_attributes

  has_many :questionnaires
  belongs_to :bus_list, optional: true

  def full_name
    out = ""
    out << name
    if full_location.present?
      out << " in "
      out << full_location
    end
    out
  end

  def full_location
    out = ""
    out << city if city.present?
    out << ", " if city.present? && state.present?
    out << state if state.present?
    out
  end

  def bus_list
    return unless bus_list_id
    BusList.find(bus_list_id)
  end

  def fips_code
    Fips.where(city: city, state: state).first
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
hackathon_manager-0.11.2 app/models/school.rb
hackathon_manager-0.11.1 app/models/school.rb
hackathon_manager-0.11.0 app/models/school.rb
hackathon_manager-0.10.3 app/models/school.rb
hackathon_manager-0.10.2 app/models/school.rb
hackathon_manager-0.10.1 app/models/school.rb
hackathon_manager-0.10.0 app/models/school.rb
hackathon_manager-0.9.2 app/models/school.rb
hackathon_manager-0.9.1 app/models/school.rb
hackathon_manager-0.9.0 app/models/school.rb
hackathon_manager-0.8.2 app/models/school.rb
hackathon_manager-0.8.1 app/models/school.rb
hackathon_manager-0.8.0 app/models/school.rb
hackathon_manager-0.7.1 app/models/school.rb
hackathon_manager-0.7.0 app/models/school.rb