Problem eager loading with sti

Here’s the setup (working off Rails 1.1.4):

Class Project
belongs_to :employee

Class Employee < Person
has_many :projects

When I try to paginate(:employees, :include =>
:projects) I get the error “Association named
‘projects’ was not found; perhaps you misspelled it?”

I can :include other models that the Person class
has_many or habtm of, and if I just refer to a
@employee.projects collection that works too.

Does anyone see what the problem could be?

Thanks,
Brian Gates


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

B Gates wrote:

‘projects’ was not found; perhaps you misspelled it?"

I can :include other models that the Person class
has_many or habtm of, and if I just refer to a
@employee.projects collection that works too.

Does anyone see what the problem could be?

If this is the actual code, Project needs to extend ActiveRecord::Base
(and I’m assuming Person already does so).

Also remember you have to restart the web server when you change things
in the database.

  • Walter

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs