Q:

Finding a specific model with some condition associated with another model

I've checked like every other question here and can't seem to find the answer.  
I have
Path:

attr_accessible :location, :total_time, :visits
belongs_to :trackedsite, :touch => true

Trackedsite:

attr_accessible :total_time, :url, :visits
has_many :paths, :autosave => true

I want to find a Path belonging to a Trackedsite with a specific location 
I have tried:
@trackedsite = Trackedsite.find_by_url(params[:url_string])
@path = @trackedsite.find_by_location(params[:path_string])

But I get "no such column: paths.trackedsite_id" (which is correct, that column doesn't exist, should I be adding something to my migration?) 

A:

Associations work by having foreign keys.  If your path belongs_to a TrackedSite by convention there needs to be a trackedsite_id, otherwise there's no link between the entities.