RailsCasts Pro episodes are now free!

Learn more or hide this

Johnzan's Profile

GitHub User: johnzan

Comments by Johnzan

Avatar

Hi, I've been experimenting with the source for this railscast and am trying to produce XML for the view of the books with the authors listed. I've got it working for Books and Authors using the following ....

respond_with(@book = Book.find(params[:id]))

in the controllers (only showing the books one above). But cannot figure out how to get the associated authors in the xml.

I've looked through the docs at http://guides.rubyonrails.org/ but can't find an example of how I'd actually get the associated authors included in the respond_with call.

I'm sure its probably trivial, but this is all new to me at the moment.

Has anyone any pointers?

Thanks,
John

Avatar

I worked through both screencasts and have a Rails 3 version working. It can be found here: git://github.com/johnzan/railscasts-episodes-episode-197.git

Hope this helps someone.