Class: ZipCode
- Inherits:
-
ActiveRecordShared
- Object
- ActiveRecord::Base
- ActiveRecordShared
- ZipCode
- Defined in:
- app/models/zip_code.rb
Class Method Summary collapse
-
.[](zip_code) ⇒ Object
Treats the class a bit like a Hash and searches for a record with a matching code.
Instance Method Summary collapse
Class Method Details
.[](zip_code) ⇒ Object
Treats the class a bit like a Hash and searches for a record with a matching code.
24 25 26 |
# File 'app/models/zip_code.rb', line 24 def self.[](zip_code) find_by_zip_code(zip_code.to_s) #|| raise(NotFound) end |
Instance Method Details
#to_s ⇒ Object
28 29 30 |
# File 'app/models/zip_code.rb', line 28 def to_s "#{city}, #{state} #{zip_code}" end |