Rendering a partial as part of JSON object

Hi,

I would like a controller to return a JSON object to my request but
would need to render a partial as string, contained in this JSON
object.

Something like :

This doesn’t work as it makes more than one call to render in the

same action
render :json => {:number => 100, :string => render(:partial =>
‘string’)}

I actually need such feature using ROR 1.2.6

Any idea how to achieve such result ?

Sebastien Grosjean - ZenCocoon

On 21 Jun 2008, at 16:53, Sébastien Grosjean - ZenCocoon wrote:

same action
render :json => {:number => 100, :string => render(:partial =>
‘string’)}

I actually need such feature using ROR 1.2.6

use render_to_string ?

Fred

Good point :wink:

That works like a charm.

Thanks a lot for your help,

Sébastien Grosjean - ZenCocoon

On Jun 21, 7:50 pm, Frederick C. [email protected]