Rails associations: How do I limit/scope a has_many :through with multiple self-referencing conditions?
问题 What's the best way to do this? I'm trying something like this, but it feels... wrong. (NOTE: It's all about the :conditions in the has_many association...) class Submission < ActiveRecord::Base belongs_to :checklist has_many :jobs, :through => :checklist, :source => :job, :conditions => ["jobs.archived = false OR jobs.archived_at > #{self.created_at} OR jobs.created_at < #{self.created_at}"] end Rails 3.2.11, Ruby 1.9.3 What I'm trying to do I need to pass multiple conditions on a has_many