Sha256: 924663de2f72e7305a1339b98fd5940e14d287a746246a9545a964bac87486e6

Contents?: true

Size: 530 Bytes

Versions: 18

Compression:

Stored size: 530 Bytes

Contents

class School < ApplicationRecord
  validates_presence_of :name

  validates_uniqueness_of :name

  strip_attributes

  has_many :questionnaires

  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 fips_code
    Fips.where(city: city, state: state).first
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
hackathon_manager-0.14.1 app/models/school.rb
hackathon_manager-0.14.0 app/models/school.rb
hackathon_manager-0.13.12 app/models/school.rb
hackathon_manager-0.13.11 app/models/school.rb
hackathon_manager-0.13.10 app/models/school.rb
hackathon_manager-0.13.9 app/models/school.rb
hackathon_manager-0.13.8 app/models/school.rb
hackathon_manager-0.13.7 app/models/school.rb
hackathon_manager-0.13.6 app/models/school.rb
hackathon_manager-0.13.5 app/models/school.rb
hackathon_manager-0.13.4 app/models/school.rb
hackathon_manager-0.13.3 app/models/school.rb
hackathon_manager-0.13.2 app/models/school.rb
hackathon_manager-0.13.1 app/models/school.rb
hackathon_manager-0.13.0 app/models/school.rb
hackathon_manager-0.12.2 app/models/school.rb
hackathon_manager-0.12.1 app/models/school.rb
hackathon_manager-0.12.0 app/models/school.rb