Skip to content

Instantly share code, notes, and snippets.

@terfender
Created May 24, 2012 11:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save terfender/2780836 to your computer and use it in GitHub Desktop.
Save terfender/2780836 to your computer and use it in GitHub Desktop.
member_model:
class Member < ActiveRecord::Base
has_many :teammembers
has_many :teams, :through => :teammembers
end
=========================
team_model:
class Team < ActiveRecord::Base
has_many :teammembers
has_many :members, :through => :teammembers
end
=========================
teammembers_model:
class TeamMembers < ActiveRecord::Base
belongs_to :member
belongs_to :team
end
=========================
Trying to get:
Member.all(:include => :team)
Error:
Association named 'team' was not found; perhaps you misspelled it?
@Favorwilliams
Copy link

My Pleasure to write you,
My name is Favor Williams,
My email address is
( Favor24@live.com)
Am interested to know
more about you,
Contact me for my
photo and other
important issue via,

Favor24@live.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment