Class: ZipCode

Inherits:
ActiveRecordShared show all
Defined in:
app/models/zip_code.rb

Class Method Summary collapse

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_sObject



28
29
30
# File 'app/models/zip_code.rb', line 28

def to_s
	"#{city}, #{state} #{zip_code}"
end