[Rails] Re: issue with eager loading in nested routes
Fred, owner do exist.
class Feature < ActiveRecord::Base
belongs_to :project
belongs_to :owner, :class_name => "User", :foreign_key => "owner_id"
end
Now in features controller, I have
@features = @project.features.find(:all, :include => :owner)
and dump for @features in view is where i see only two features being
loaded and not the corresponding owner (only 1 in this case, with id
1) -
---
- !ruby/object:Feature
attributes:
project_id: "1"
updated_at: 2009-10-24 11:07:19
details: Represent Single Source Mode opcode
priority: nornal
id: "2"
owner_id: "1"
brief: Opcode - SSM
created_at: 2009-10-24 11:07:19
attributes_cache: {}
- !ruby/object:Feature
attributes:
project_id: "1"
updated_at: 2009-10-24 11:26:09
details: for testing
priority: normal
id: "3"
owner_id: "1"
brief: test feature updated
created_at: 2009-10-24 11:18:11
attributes_cache: {}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home