We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Following #38, we'd want a user to follow stories and discussions.
We can add a polymorphic association like so:
# app/models/user_subscription.rb class UserSubscription < ApplicationRecord belongs_to :user belongs_to :subscribable, polymorphic: true end # app/models/user.rb class User < ApplicationRecord has_many :user_subscriptions end # app/models/story.rb class Story < ApplicationRecord has_many :discussions has_many :user_subscriptions, as: :subscribable end # app/models/discussion.rb class Discussion < ApplicationRecord belongs_to :story has_many :posts has_many :user_subscriptions, as: :subscribable end
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Following #38, we'd want a user to follow stories and discussions.
We can add a polymorphic association like so:
The text was updated successfully, but these errors were encountered: