Sebastian Böck
2005-Sep-29 16:17 UTC
:include doesn''t respect :conditions of the included model
Hi all,
I have something like the following in my model(s)
class Person < ActiveRecord::Base
has_many :planung
has_one :last_planung
:class_name => "Planung",
:conditions => "exist IS TRUE",
:order => "date DESC"
end
class Planung < ActiveRecord::Base
belongs_to :person
end
And the corresponding controller looks like
class PersonController < ApplicationController
def index
@person = Person.find(:all, :include => [:last_planung])
end
end
The actual problem is that the :include of :last_planung doesn''t
respect the :conditions of last_planung. I can''t find anything in the
docs mentioning this problem.
Are there any solutions?
Any help appreciated
Sebastian
Reasonably Related Threads
- :conditions on has_one realationship
- Paginate include => :last and order by value
- has_one :through NoMethodError: undefined method `klass' for nil:NilClass when doing class_name on reflection
- Site Navigation With Polymorphic Has Many Through
- activerecord generating wrong syntax with postgresql
