Partials every-where

March 3, 2010 at 11:57 am (Partials) (, , , )

Hi everybody,

Partials are not limited to be used for HTML rendering.

They can be used for XML too.

Here is an example file ( _details.builder )
xml.name user.name
xml.gender user.gender
xml.age user.age

This can be used in another regular builder file as follows:
xml.instruct! : xml, :version=>”1.0″
xml.users {
for user in users
xml <“users/details” , :locals=>{:user=>user})
end
}

Hope, this comes handy 🙂

1 Comment

  1. Nice post said,

    Good to see your blog being updated. Why not we have these articles written in the webile blog.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: