Skip to content

Instantly share code, notes, and snippets.

@workmad3
Created February 2, 2010 22:02
Show Gist options
  • Save workmad3/293094 to your computer and use it in GitHub Desktop.
Save workmad3/293094 to your computer and use it in GitHub Desktop.
class Feed < ActiveRecord::Base
has_many :subscriptions
has_many :users, :through => :subscriptions
belongs_to :owner, :class_name => "User"
end
class Subscription < ActiveRecord::Base
belongs_to :user
belongs_to :feed
end
class User < ActiveRecord::Base
has_many :subscriptions
has_many :feeds, :through => :subscriptions
has_many :owned_feeds, :class_name => "Feed", :source => :owner
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment