Skip to content

Instantly share code, notes, and snippets.

@DCarper
Created February 23, 2011 01:46
Show Gist options
  • Select an option

  • Save DCarper/839828 to your computer and use it in GitHub Desktop.

Select an option

Save DCarper/839828 to your computer and use it in GitHub Desktop.
class FantasyFootballLeague < ActiveRecord::Base
has_many :memberships, :as => :app
end
class MarchMadnessBracket < ActiveRecord::Base
has_many :memberships, :as => :app
end
class Membership < ActiveRecord::Base
belongs_to :app, :polymorphic => true
end
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