Given a school model and a student model with the school having a has_many
relation to student:
has_many :students, :conditions => proc {
"year_id=#{send(:active_year_id)}" }
where active_year_id is a method defined in the school model, I'm
encountering an error that "active_year_id is undefined" when calling:
School.where(:active => true).includes(:students)
The condition works fine when I do, say, School.where(:id => 10).students.
Only when I try to use includes do I get that error. Is that the right
behavior. If not, what am I doing wrong and how do I fix ?
Using Rails 3.0.9, REE 1.8.7.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/9rsY1unEtsEJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.