Module: ZipMeta::Util
- Defined in:
- lib/zip_meta/util.rb
Overview
Contains implementation of the “zip_meta” method, which queries the zip_meta table for a record corresponding to the zipcode passed in.
Instance Method Summary collapse
-
#zip_meta(zipcode) ⇒ Object
Implementation of the “zip_meta” method, which queries the zip_meta table for a record corresponding to the zipcode passed in.
Instance Method Details
#zip_meta(zipcode) ⇒ Object
Implementation of the “zip_meta” method, which queries the zip_meta table for a record corresponding to the zipcode passed in.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/zip_meta/util.rb', line 9 def (zipcode) connection = ::ActiveRecord::Base.connection result_set = connection.select_all("SELECT * FROM zip_meta WHERE zip=#{connection.quote(zipcode)}") if result_set.count == 0 nil else = result_set[0] .delete("id") .symbolize_keys! end end |