Forum: Ruby Re: in_place_editor on Rails 1.2.1 seems to be broken

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
F1b0c5e0a1032e096a2888b61abc53c3?d=identicon&s=25 Tom V. (Guest)
on 2007-04-04 16:58
(Received via mailing list)
I have a similar problem.
I am using in_place_editor with the :load_text_url option:

<div id="editme">
    <%= h file_contents %>
<%= in_place_editor 'editme',
    :url => url_for({ :action => 'save_file', :path => file_path }),
    :load_text_url => url_for({ :action => 'file_contents', :path =>
file_path }),
    :save_text => 'save',
    :rows => 30,
    :cols => 88

The contents of a file is rendered inside the div.
Whenever I click it, the in_place_editor does some strange escaping to
the file contents:

< (less than) becomes &lt;
> (greater than) becomes &gt;
& (ampersand) becomes &amp;
" (double quote) becomes &quot;

At the end of the file, double slashes ( // ) are added.

I tried a couple of other special characters ( * / \ # ' @ ยง ).
Those do not get escaped...
If I hit cancel and the form closes, all changes made to < > & " are

Funny thing is when I save the form and reopen it,
those escapes escape themselves ( &lt; ==> &amp;lt; )...

Slashes inside the file_path also get escaped (%2F).


I use a JS call to get width/height of the current window
but I have no idea how to assign those values to :rows/:cols..?

p.s.: early I answered Rolando's post using google-groups but that seems
to have failed.
If anyone gets my post twice I apologize...
This topic is locked and can not be replied to.