Skip to content

Instantly share code, notes, and snippets.

@stephenprater
Created July 12, 2011 16:15
Show Gist options
  • Save stephenprater/1078326 to your computer and use it in GitHub Desktop.
Save stephenprater/1078326 to your computer and use it in GitHub Desktop.
has_many :user_favorite_markets
:class_name => "UserFavoriteMarket",
:foreign_key => :user_id
has_many :favorite_markets,
:class_name => "FarmersMarket",
:through => :user_favorite_markets
:source => :market
# I think this is the general idea. You have to have an association for the join table as well.
has_many :favorite_markets,
:through => :user_favorite_markets
:select => 'markets.name, user_favorite_markets.*',
:source => :market
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment