I have a model class that has, among other things:
class Group < ActiveRecord::Base
has_many :subscriptions
has_many :users, :through => :subscriptions
has_many :admins, :through => :subscriptions, :source => :user, :conditions => "subscriptions.role = #{ROLES[:admin]}"
has_many :subscribers, :through => :subscriptions, :source => :user, :conditions => "subscriptions.role >= #{ROLES[:subscriber]}"
has_many :authors, :through => :subscriptions, :source => :user, :conditions => "subscriptions.role >= #{ROLES[:author]}"
has_many :pending_subscribers, :through => :subscriptions, :source => :user, :conditions => "subscriptions.pending = true"
end
The number of times :through => :subscriptions, :source => :user
is repeated bothers me. I know in routes files, you can do map.with_options
. Is there something like that for my model associations?