From: "Tom V." Date: 2007-04-04T23:57:47+09:00 Subject: Re: in_place_editor on Rails 1.2.1 seems to be broken I have a similar problem. I am using in_place_editor with the :load_text_url option:
<%= 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 < > (greater than) becomes > & (ampersand) becomes & " (double quote) becomes " 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 cancelled. Funny thing is when I save the form and reopen it, those escapes escape themselves ( < ==> &lt; )... Slashes inside the file_path also get escaped (%2F). Regards, Tom. btw: 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... -------------------------------------------------------------------------- On Feb 3, 2:51 am, Rolando Lora wrote: > The upgrade to the last version of rails (1.2.1) and prototype (1.5.0) > seems to introduce a bug in the "in_place_editor'. > > Below a piece of code from an application that was on production: > > === VIEW === > > <%=in_place_editor( > "salary_benefit_earnings_percentage_#{ salary_benefit.id }", > { :size => 5, > :url => { :action => :update_benefit, > :attribute => "earnings_percentage", > :old_value => salary_benefit.earnings_percentage, > :id => salary_benefit.id } } ) %> > > === HTML SRC === > > > === EVALUATION OF PARAMS IN THE CONTROLLER === > params > > {"amp;old_value"=>"0.0", > "action"=>"update_deduction", > "id"=>"43", > "value"=>"5", > "controller"=>"human_resources/personnel_members", > "attribute"=>"fixed_number_of_hours"} > > The URL in the html src has an & escaped, and one param has 'amp;' > prefixed to it. I tried with multiple interfaces where thein_place_editorhas a wrong behavior. > > Is someone else having similar problems? Could it be a bug in thein_place_editoror in the routing module? > > --