Skip to content

Instantly share code, notes, and snippets.

@jameswritescode
Created October 14, 2012 06:57
Show Gist options
  • Select an option

  • Save jameswritescode/3887675 to your computer and use it in GitHub Desktop.

Select an option

Save jameswritescode/3887675 to your computer and use it in GitHub Desktop.
class Relation < ActiveRecord::Base
belongs_to :feed
belongs_to :user
end
class User < ActiveRecord::Base
has_many :relations
has_many :feeds, through: :relations, uniq: true
end
class Feed < ActiveRecord::Base
has_many :relations
has_many :users, through: :relations, uniq: true
has_many :entries
end
class Entry < ActiveRecord::Base
has_one :feed
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment