On 13 Sep 2008, at 16:11, Adam wrote:
>
>
> My question is, what do I need to include in the model in order to use
> the xml builder? I want to write in blog.rb
>
> def to_rss
>    xml.item do
>       xml.title            self.subject
>       xml.link            blogs_path
>       xml.description self.body
>       xml.guid           blogs_path
>       xml.pubDate     self.created_at
>    end
> end
>

> This raises an error like "undefined variable xml". Does anyone know
> how to solve this?
>

In the context of an rxml view, an instance of Builder::XMLMarkup has  
already been created for you and assigned to the local variable xml.  
You just need to do the same. See also the examples at 
http://builder.rubyforge.org/

Fred
> Many thanks,
> Adam
> >


--~--~---------~--~----~------------~-------~--~----~
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