Class: Zipcode
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Zipcode
- Defined in:
- lib/generators/us_zipcode/templates/zipcode_model.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.find_by_city(city) ⇒ Object
14 15 16 |
# File 'lib/generators/us_zipcode/templates/zipcode_model.rb', line 14 def find_by_city(city) includes(:county).where("city like '#{city}%'") end |
Instance Method Details
#county_and_zip ⇒ Object
19 20 21 |
# File 'lib/generators/us_zipcode/templates/zipcode_model.rb', line 19 def county_and_zip "#{county.name}: #{code}" end |
#is_geocoded? ⇒ Boolean
27 28 29 |
# File 'lib/generators/us_zipcode/templates/zipcode_model.rb', line 27 def is_geocoded? (!lat.nil? && !lon.nil?) end |
#latlon ⇒ Object
23 24 25 |
# File 'lib/generators/us_zipcode/templates/zipcode_model.rb', line 23 def latlon [lat, lon] end |