I run into these sort of to_xml problems all the time. Especially with
nested models it gets really ugly, but I think for you just adding a
line to your model should fix it.
...I've been working on an issue similar to this is on another thread
but its a little more complicated because it uses order and a join,
but your situation is similar.
Here is how I would solve your issue.
Add this line to your model
class Library << ActiveRecord::Base
has_many :long_books, :class_name => "Book", :conditions =>
'pages > 100'
Now update the controller to include :long_books
Library.find(:all, :include => :long_books).to_xml