Is it ok to have only one model that can hold many different types of subscriptions?
For example, lets say you can subscribe to comments, users, forum threads and news articles inside of an application. They all have different types of columns though. This how it would look with the associations setup.
Users
attr_accessible :name, :role
has_many :subscriptions
has_many :comments, :threads, :articles, :through => :subscriptions
Comments
:content, :rating, :number
has_many :subscriptions
has_many :subscribers, :through => :subscriptions, :class_name => 'User'
Threads
:title, :type, :main_category
has_many :subscriptions
has_many :subscribers, :through => :subscriptions, :class_name => 'User'
Articles
:news_title, :importance
has_many :subscriptions
has_many :subscribers, :through => :subscriptions, :class_name => 'User'
Subscription
:content, :rating, :number, :name, :role, :title, :type, :main_category,
:news_title, :importance, :user_id, :comment_id, :thread_id, :article_id
belongs_to :user, :comment, :thread, :article
Basically with one subscription model a user can choose to subscribe to a comment, thread or article and even all three at once. Can it work this way? Where one model can hold all different types of subscriptions, especially when you want to compare attributes to do certain things like articles for certain users?
You could try to do this more universal with polymorphic associations:
http://guides.rubyonrails.org/association_basics.html#polymorphic-associations
For example,
and then create new subscription like this
and use it like this (if you actually care about type)