# Ajax In place editor to send modifications

**URL:** <https://www.ruby-forum.com/t/ajax-in-place-editor-to-send-modifications/188172>\
**Category:** Rails\
**Created:** [May 6, 2010, 9:32pm UTC](https://www.ruby-forum.com/t/ajax-in-place-editor-to-send-modifications/188172 "2010-05-06T21:32:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rcanand](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/6bbea6/32.png) [@rcanand](https://www.ruby-forum.com/u/rcanand)\
**Post date:** [May 6, 2010, 9:32pm UTC](https://www.ruby-forum.com/t/ajax-in-place-editor-to-send-modifications/188172/1 "2010-05-06T21:32:58Z")

</div>

Hi,

I have a requirement to use an Ajax in place editor on a set of snippets  
to  
allow user to modify existing content. Once edited, however, I want the  
ok  
button to NOT modify the original snippet, but instead, send the content  
to  
another action, which then updates a different object.

Currently, I have the following code:

\_snippets.html.erb

\<%for snippet in @snippets%\>

...\<%= snippet.paragraph %\>...

 \<%= set\_page\_snippet\_url = url\_for( :controller =\> 'books', :action =\> 'set\_page\_snippet', :snippet\_id =\> snippet.id, :relative\_id =\> @relative.id )%\> \<%end%\>

books\_controller.rb

def set\_page\_snippet  
…  
end

The problem I see is:

1. the set\_page\_snippet never fires (when I add a debugger line to  
set\_page\_snippet)
2. On clicking ok after editing a snippet, the snippet that was edited  
changes to show the home page

How can I get the original snippet to remain unchanged after edit and  
have  
the set\_page\_snippet to fire (with params[:value] containing the edited  
text)?

Thanks  
Anand
