in place editor and rjs

Hi all,

I've had a read thru similar topics on the list but am still confused...

I want an in place editor to call an action that does some rjs, not just return a text string.

Normally the action would do something like:

  def edit     # model.update(params[:value]     render :text => params[:value]   end

But I want to do more stuff:

  def edit     # model.update(params[:value]     render :action => 'edit.rjs'   end

What options do I need to use in the view to evaluate the javascript returned? At the moment the javascript is just being displayed in the field as a string.

I have hacked together the following, but is there a cleaner 'more rails' way to do this?

<%= in_place_editor @model.id, :url => {:action => 'edit', :id => @model.id},   :complete => "function(transport, element){     // Id rather use rjs to do my javascript than have it in the view like this.     $ ('another_element_that_i_want_to_update').update(transport.responseText);   }" %>

Any advice greatly appreciated,

Barry.

I'd been using an old version of the helper. I downloaded the current version of in_place_editor_field plugin and passed the option:

<%= in_place_editor_field .., .., :script => true %>

Works fine now. Cheers.