I'm using the ruby geocoder gem to search by location. I want to limit searches to locations that have officially launched. If someone searches by zip, this is easy using a regex. But if someone searches by city, I need to convert the city into a zip code, check my zip table and if positive, return the search results. 

The [geocoder api](http://rubydoc.info/gems/geocoder/frames) has a section for reverse geocoding: 

```
reverse_geocoded_by :latitude, :longitude do |obj,results|
  if geo = results.first
    obj.city    = geo.city
    obj.zipcode = geo.postal_code
    obj.country = geo.country_code
  end
end
after_validation :reverse_geocode

```

This is obviously built just for using in the model. But I'm attempting to use it within my controller, but obj.zipcode is not working much at all. Geocoder.search('san jose, ca') seems to return what i need, i just don't know how to get to it. Here's where I'm at:

```
  if params[:search].present?
#       coords = Geocoder.coordinates(params[:search])
    zip = Geocoder.search(params[:search])
    if Zip.where(:zip => (params[zip.zipcode]), :launch => true).exists?
      addresses = Address.near(params[:search], 25, :order => :distance)
      @profiles = addresses.map{ |ad| ad.profile }.uniq unless addresses.nil?
      @title = "Addresses Near " + (params[:search]).to_s
    else
      if Zip.where(:zip => (params[zip.zipcode]), :nearlaunch => true).exists?
        addresses = Address.near(params[:search], 25, :order => :distance)
        @profiles = addresses.map{ |ad| ad.profile }.uniq unless addresses.nil?
        @title = "We have not launched for your location but these are near by " + (params[:search]).to_s
      else
        redirect_to :controller => 'pages', :action => 'notlaunched'
      end
    end

```