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 ?

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

use render_to_string ?

Fred

Good point :wink:

That works like a charm.

Thanks a lot for your help,