Does an SQL database provide an example of using Builder to create multiple XML files. I can easily create a whole database here ...
  DIF index response_to do | Format | Format.xml {@rides = Rides.find (: all)} End and   This will create a file called index.xml, based on a file named index.xml.builder It has the following code
  xml.instruct! Do Xml.rides do @ rides.each Ride | | Xml.item ("togive" => Ride togive, "totake" => Ride totake, "howlong" => Ride howlong, "isoffer" => Ride.Eoffer, "ID "= & Gt; Ride.id," Contact "= & gt; Ride Contact) End of End   Here are the only lines of my routes. RB
  map.resources: ride map.connect ': Controller /: Action /: ID' map.connect ': Controller /: Action /: id: format'   This works fine, but how do I
thanks
edit: convert from format.rss to format.xml create a new file
I'm not sure what you are trying to achieve, but you have another way in your controller Which gives the final ride:
  DF When Kiri Uttr_ | Format | Format.xml {@last_ride = Rides.last} End End    And then in the visual template  last.xml.builder  you can do something like this: 
  xml.instruct! Xml.rides do xml.item ("togive" = & gt; @last_ride.togive, "totake" = & gt; @last_ride.totake etc ...)    if you From this perspective you will need to modify your  config / routes.rb  file to add a new  list  action: 
 < Code> map Source: Ride,: Collection = & gt; {: Final = & gt; From this you can access the route using    Alternatively, you can easily find the  Make conditional calls in the  index  method of the controller so that all the rides or last rides can be found as appropriate, in this case you can see the current  index.xml.builder  The visual template should be able to reuse because it will only produce an archive that only one ride Switch to it. 
 
No comments:
Post a Comment