That did the trick! Thanks!

But, I am sorry I did not get your explanation. Forgive me, I am very
new to Ruby and Rails. Could you please explain why it didn't work
before, and why it worked your way?

On Aug 27, 7:47 am, Frederick Cheung <[email protected]>
wrote:
> On Aug 27, 8:35 am, John Doe <[email protected]> wrote:
>
>
>
> > In my projects controller, I am trying to do this:
>
> > @projects = Project.find(:all, :include => [:books])
>
> > My hope is to get a nested data structure back that looks something
> > like:
>
> Well you what you get back is an array of projects where the book
> objects have already been fetched fro the database
> If you call to_json(:include => :books) then you should get output
> pretty similar to what you've described.
>
> Fred
>
>
>
>
>
>
>
> > projects: [
> >   {
> >     ..,
> >     books: [
> >         {
> >           ..
> >         },
> >         {
> >           ..
> >         }
> >     ]
> >   }
> > ]
>
> > But that does't work. How can I achieve this?
>
> > Thanks in advance!

-- 
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 [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.

Reply via email to