Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
app
 
 
bin
 
 
 
 
db
 
 
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Geocoder-Polymorphism-Example

The code from my blog post: http://www.breefield.com/essays/polymorphic-geocoder

To play with polymorphic joins on a geocoded Location model do the following Clone the repo, it runs on Sqlite, so no need to setup a DB. Run rake db:migrate then rake db:seed Now run rails console and then try this out:

Location.near('San Francisco', 50).filter_by(:event).where('events.price <= ?', 20)

Know that Location has a polymorphic relationship with both ````EventandVenue```.

class Location < ActiveRecord::Base
  belongs_to :located, :polymorphic => true
end

About

How to abstract away a Location model with Geocoder.

Resources

Releases

No releases published

Packages

No packages published