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%>
<p id=''snippet_<%=snippet.id%>''>...<%=
snippet.paragraph %>...</p>
<%= set_page_snippet_url = url_for(
:controller => ''books'',
:action => ''set_page_snippet'',
:snippet_id => snippet.id,
:relative_id => @relative.id
)%>
<script type="text/javascript">
new Ajax.InPlaceEditor(''snippet_<%=snippet.id%>'',
''#{set_page_snippet_url}''
, {rows:15,cols:50});
</script>
<%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
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.