Last active
August 29, 2015 13:55
-
-
Save jenrzzz/8749099 to your computer and use it in GitHub Desktop.
This file contains 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 Like < ActiveRecord::Base | |
belongs_to :likeable, polymorphic: true | |
belongs_to :user | |
end | |
class Project < ActiveRecord::Base | |
has_many :likes, as: :likeable | |
end | |
class Source < ActiveRecord::Base | |
has_many :likes, as :likeable | |
end | |
class User < ActiveRecord::Base | |
has_many :likes, inverse_of: :user | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment