Created
February 23, 2011 01:46
-
-
Save DCarper/839828 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class FantasyFootballLeague < ActiveRecord::Base | |
| has_many :memberships, :as => :app | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MarchMadnessBracket < ActiveRecord::Base | |
| has_many :memberships, :as => :app | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Membership < ActiveRecord::Base | |
| belongs_to :app, :polymorphic => true | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class User < ActiveRecord::Base | |
| has_many :memberships | |
| # | |
| # We want | |
| # | |
| has_many :march_madness_brackets, :through => :memberhsips | |
| has_many :fantasy_football_leagues, :through => :memberships | |
| # | |
| # But the above code does not work >( | |
| # | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment