logo       

[Rails] Would like include model association in to_xml: msg#03303

RubyonRailsTalk

Subject: [Rails] Would like include model association in to_xml

i have:

class Library << ActiveRecord::Base
     has_many :books
end

class Book << ActiveRecord::Base
    belongs_to :library
end

in my controller i have:

render :xml=> Library.find(:all).to_xml(:include=>books)
but, i would like put a condition in the books ( e.: pages >= 100 )

i would like to create a xml with all Libraries, but books with pages more than 100)

How to do this?



--
Ítalo Matos Cavalcante Santos
Desenvolvedor Web/Mobile
Analista de Sistemas
http://italomatos.wordpress.com/ - Flex nos Trilhos
http://del.icio.us/italomatos
http://www.activebrasil.com.br

--~--~---------~--~----~------------~-------~--~----~
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@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@xxxxxxxxxxxxxxxx
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | Mail Home | sitemap | FAQ | advertise