Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Kat Padilla katpadi

🎯
Focusing
Block or report user

Report or block katpadi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View associations.rb
# use inverse_of to 'just work'
class User < ActiveRecord::Base
has_many :contributions, inverse_of: :user
has_many :posts, through: :contributions
end
class Post < ActiveRecord::Base
has_many :contributions, inverse_of: :post
has_many :contributors, through: :contributions,
source: :user
You can’t perform that action at this time.