    <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
     <channel>
        <title>vaporbase :: Restful In Place Editor</title>
        <link>http://www.vaporbase.com/</link>
        <description>the knowledge base that almost is</description>
        <dc:language>en-us</dc:language> 
        <dc:creator>Vaporbase Admin</dc:creator> 
        <admin:generatorAgent rdf:resource="http://www.xaraya.org" /> 
        <admin:errorReportsTo rdf:resource="mailto:admin@parkerhill.com" /> 
       <sy:updatePeriod>hourly</sy:updatePeriod> 
       <sy:updateFrequency>1</sy:updateFrequency> 
       <docs>http://backend.userland.com/rss</docs>

<!-- show a header for the current publication type -->
        <h2>Postings</h2>


<div class="xar-mod-head"><span class="xar-mod-title">rails</span></div>

<table border="0" cellpadding="1" cellspacing="0">
<tr>
    <td valign="top">
        Browse in :
   </td>
   <td valign="top">

                                    <a href="http://www.vaporbase.com/postings/">All</a>

                 &gt;                     <a href="http://www.vaporbase.com/postings/c36/">subjects</a>

                 &gt;                     <a href="http://www.vaporbase.com/postings/c42/">rails</a>
<br />
</td>
</tr>
</table>






<div class="xar-error">
   <p>
 <strong>Note:</strong> when you create a new publication type,
the articles module will automatically use the templates
<em>user-display-[publicationtype].xd</em>
and <em>user-summary-[publicationtype].xd</em>.
If those templates do not exist when you try to preview or display a new article,
you'll get this warning :-)  Please place your own templates in themes/<em>yourtheme</em>/modules/articles
The templates will get the extension .xt there. </p>
</div>
<div class="xar-norm xar-standard-box-padding">
   <h1><strong>Title:</strong>&nbsp;Restful In Place Editor</h1>
<p><strong>Author:</strong>&nbsp;linoj</p>
<p>
<strong>Date:</strong> February 11, 2008 3:40:13 AM  or Mon, 11 February 2008 03:40:13 </p>
<p><strong>Summary:</strong>&nbsp;Here's a patch to the in_place_editor to work smoother with RESTful resources.</p>
<p><strong>Body:</strong>&nbsp;<p>I was bothered that using the standard in_place_editor helpers for Rails required I add new actions to my controllers and corresponding routes in routes.rb.  </p><p>As of Rails 2.0  it&#39;s is now a plug-in rather than part of core. I should probably make my changes a separate plug-in, or better, submit this as a patch. Instead, for now, I suggest you install the plug-in and copy and hack the code.  </p><p>To install,</p><pre>$ script/plugin install <a href="http://svn.rubyonrails.org/rails/plugins/in_place_editing/" target="_blank">http://svn.rubyonrails.org/rails/plugins/in_place_editing/</a> </pre><p>Open the file vendor/plugins/in_place_editing/lib/in_place_macros_helper.rb and copy the two methods, in_place_editor and in_place_editor_field to your app/helpers/application_helper.rb</p><h2>in_place_editor helper</h2><p>We add a new option to this helper:</p><pre>:as     Name of the param the value is returned into<br />        e.g. :as =&gt; &#39;foo[name]&#39; </pre><p>To the in_place_editor method, add the following line after the js_options[&#39;callback&#39;] = line:</p><pre>    js_options[&#39;callback&#39;]   = &quot;function(form) { return #{options[:with]} }&quot; if options[:with]<br />    <strong># this line is the only change<br />    js_options[&#39;callback&#39;]   = &quot;function(form,value) { return &#39;#{options[:as]}=&#39; + escape(value) }&quot; if options[:as]</strong><br /></pre><p>&nbsp;</p><h2>in_place_editor_field helper</h2><p>In this we make just 2 changes. First, the default :url will now be your standard :update action in the controller. And 2nd, the new value will be set using standard REST parameters, eg params[:foo =&gt; { attribute_name =&gt; value }]</p><br /><pre># Renders the value of the specified object and method with in-place editing capabilities.<br />def in_place_editor_field(object, method, tag_options = {}, in_place_editor_options = {}) tag = ::ActionView::Helpers::InstanceTag.new(object, method, self)<br />  tag_options = {:tag =&gt; &quot;span&quot;, :id =&gt; &quot;#{object}_#{method}_#{tag.object.id}_in_place_editor&quot;, :class =&gt; &quot;in_place_editor_field&quot;}.merge!(tag_options) <br /><strong>  in_place_editor_options[:url] ||= { :action =&gt; &quot;update&quot;, :id =&gt; tag.object.id, :method =&gt; :post, :_method =&gt; :put }<br />  in_place_editor_options[:as] = &quot;#{object}[#{method}]&quot;<br /></strong>  tag.to_content_tag(tag_options.delete(:tag), tag_options) + in_place_editor(tag_options[:id], in_place_editor_options)<br />end</pre><br /><br /><h2>Your controller</h2><p>Last but not least you do things differently in your controller than the standard in_place_editor. </p><p><em>You do not need to use &quot;in_place_edit_for&quot; at all!  </em>Forgetaboutit!!</p><p>Rather, you just change the #update action to respond to ajax calls, as follows:</p><pre>  # PUT /foo/1<br />  def update<br />    @foo = Foo.find(params[:id])<br />    success =  @foo.update_attributes(params[:foo])<br />    respond_to do |format|<br />      format.html do<br />        if success<br />          flash[:notice] = &#39;Foo was successfully updated.&#39;<br />          redirect_to(@foo) <br />        else<br />          render :action =&gt; &quot;edit&quot;<br />        end<br /> <strong>    format.js do<br />         # assume updating only one attribute<br />         attribute = params[:foo].keys.first.to_s<br />         render :text =&gt; self.class.attributes.include? attribute ? @foo[attribute] : &#39;(bad attribute)&#39;<br />     end</strong><br />   end<br /> end<br /></pre><p>Basically we update the attributes in params, as usual. Except when its an ajax call, we assume there&#39;s really only one attribute in the params being updated. And the ajax renders the new value for updating the page.</p><p>A bit unconventionally, I do the update_attributes first then respond based on format. That&#39;s because, as mentioned in other blogs, there&#39;s no easy way to handle validations when doing in_place_editing. But then again it can be done (google it), and change your #update action as needed.  </p><h2>Views</h2><p>There&#39;s nothing to change in the views, they work the same as the standard in_place_editor, for example</p><pre>&lt;%= in_place_editor_field &quot;foo&quot;, :title %&gt;</pre><p>&nbsp;</p><p>PS Thanks for the leethal comments... :)</p><p>&nbsp;</p><p>UPDATE  March 4, 2008</p><p>I found some views reference attributes better handled from a different controller than the current one, like associations of the current resource. I&#39;ve modified the in_place_editor_field to use a controller based on the resource object name rather than assume the current controller.</p><p>I also added support for a :formatter option, so you can run the content through a filter before updating the view. For example, I use BlueCloth formatting, and specify :formatter =&gt; &#39;markdown&#39; on my text attributes. </p><p>Here&#39;s the full helper: </p><pre>  def in_place_editor_rest(object, method, tag_options = {}, in_place_editor_options = {})<br />    tag = ::ActionView::Helpers::InstanceTag.new(object, method, self)<br />    tag_options = {:tag =&gt; &quot;span&quot;, :id =&gt; &quot;#{object}_#{method}_#{tag.object.id}_in_place_editor&quot;, :class =&gt; &quot;in_place_editor_field&quot;}.merge!(tag_options)<br />    in_place_editor_options[:url] ||= { <strong>:controller =&gt; object.pluralize, </strong>:action =&gt; &quot;update&quot;, :id =&gt; tag.object.id, :method =&gt; :post, :_method =&gt; :put }<br />    in_place_editor_options[:as] = &quot;#{object}[#{method}]&quot;<br />    <strong># changed to support inline formatter </strong><br /><strong>    if formatter = in_place_editor_options.delete(:formatter)</strong><br /><strong>      in_place_editor_options[:load_text_url] ||= { :controller =&gt; object.pluralize, :action =&gt; &#39;show&#39;, :id =&gt; tag.object.id, :attribute =&gt; method.to_s } </strong><br /><strong>      var = @template.instance_variable_get(&quot;@#{object}&quot;)</strong><br /><strong>      value = var.send(method)</strong><br /><strong>      content = content_tag(tag_options.delete(:tag), @template.send( formatter, value), tag_options)</strong><br /><strong>    else</strong><br />      content = tag.to_content_tag(tag_options.delete(:tag), tag_options)<br />    end<br />    content + in_place_editor(tag_options[:id], in_place_editor_options)<br />  end</pre><p>&nbsp;</p></p>
<p><strong>Notes:</strong>&nbsp;</p>
<p><em>More fields may be available via dynamicdata ..</em></p>
        <p>Last modified on Mar 04, 2008 9:50:32 PM by <a href="http://www.vaporbase.com/roles/3">linoj</a></p>
        <p>



<div>
   <p class="xar-cm-note xar-sub">
 Note: Comments are owned by the poster. We are not responsible for their content. </p>
</div>
    <div class="xar-accent-outline xar-cm-comment">
    <div>
         <a name="345"></a>
                <form action="http://www.vaporbase.com/?module=comments&amp;func=reply" method="post" class="xar-cm-actions">
                    <div>
                        <input type="hidden" name="header[modid]" value="151" />
                        <input type="hidden" name="header[itemtype]" value="9" />
                        <input type="hidden" name="header[objectid]" value="158" />
                        <input type="hidden" name="header[pid]" value="345" />
                        <input type="hidden" name="receipt[returnurl][decoded]" value="http://www.vaporbase.com/postings/Restful_In_Place_Editor?&amp;depth=1&amp;order=1&amp;sortby=2&amp;render=flat" />
                        <input type="hidden" name="receipt[returnurl][encoded]" value="http%3A%2F%2Fwww.vaporbase.com%2Fpostings%2FRestful_In_Place_Editor%3F%26amp%3Bdepth%3D1%26amp%3Border%3D1%26amp%3Bsortby%3D2%26amp%3Brender%3Dflat" />
                        <input type="hidden" name="receipt[action]" value="reply" /> 
                        <input type="submit" name="submit" id="submit-reply345" value="Reply" />
                   </div>
               </form>

                <h4>Restful In Place Editor</h4>
<!-- show changelog -->
<!-- end changelog -->
           <span class="xar-sub">
 Posted by:                     Anonymous on                 February 23, 2008 05:17 AM</span>
       </div>
       <div class="xar-accent xar-cm-comment">
                This is good, thank you! I'll leave you a lethal comment next time. :)                <p>
                    <a href="http://www.vaporbase.com/?module=comments&amp;func=display&amp;cid=345" title="Permalink" rel="bookmark">
                       #
                   </a>
               </p>

       </div>

</div>

    <div class="xar-accent-outline xar-cm-comment">
    <div>
         <a name="348"></a>
                <form action="http://www.vaporbase.com/?module=comments&amp;func=reply" method="post" class="xar-cm-actions">
                    <div>
                        <input type="hidden" name="header[modid]" value="151" />
                        <input type="hidden" name="header[itemtype]" value="9" />
                        <input type="hidden" name="header[objectid]" value="158" />
                        <input type="hidden" name="header[pid]" value="348" />
                        <input type="hidden" name="receipt[returnurl][decoded]" value="http://www.vaporbase.com/postings/Restful_In_Place_Editor?&amp;depth=1&amp;order=1&amp;sortby=2&amp;render=flat" />
                        <input type="hidden" name="receipt[returnurl][encoded]" value="http%3A%2F%2Fwww.vaporbase.com%2Fpostings%2FRestful_In_Place_Editor%3F%26amp%3Bdepth%3D1%26amp%3Border%3D1%26amp%3Bsortby%3D2%26amp%3Brender%3Dflat" />
                        <input type="hidden" name="receipt[action]" value="reply" /> 
                        <input type="submit" name="submit" id="submit-reply348" value="Reply" />
                   </div>
               </form>

                <h4>Restful In Place Editor</h4>
<!-- show changelog -->
<!-- end changelog -->
           <span class="xar-sub">
 Posted by:                     Anonymous on                 February 29, 2008 07:21 AM</span>
       </div>
       <div class="xar-accent xar-cm-comment">
                thank you for this patches, but I still cannot get it working. I also applied the patches for the protect_from_forgery bug (http://dev.rubyonrails.org/ticket/10055) but still get InvalidAuthenticityToken

this is my view:

&lt;% for context in @contexts %&gt;
&lt;% @context = context %&gt;
  <tr>
    <td>&lt;%= in_place_editor_field :context , :name %&gt;</td>
  </tr>
&lt;% end %&gt;
</table>
<br />
&lt;%= will_paginate @contexts %&gt;
                <p>
                    <a href="http://www.vaporbase.com/?module=comments&amp;func=display&amp;cid=348" title="Permalink" rel="bookmark">
                       #
                   </a>
               </p>

       </div>

</div>

    <div class="xar-accent-outline xar-cm-comment">
    <div>
         <a name="349"></a>
                <form action="http://www.vaporbase.com/?module=comments&amp;func=reply" method="post" class="xar-cm-actions">
                    <div>
                        <input type="hidden" name="header[modid]" value="151" />
                        <input type="hidden" name="header[itemtype]" value="9" />
                        <input type="hidden" name="header[objectid]" value="158" />
                        <input type="hidden" name="header[pid]" value="349" />
                        <input type="hidden" name="receipt[returnurl][decoded]" value="http://www.vaporbase.com/postings/Restful_In_Place_Editor?&amp;depth=1&amp;order=1&amp;sortby=2&amp;render=flat" />
                        <input type="hidden" name="receipt[returnurl][encoded]" value="http%3A%2F%2Fwww.vaporbase.com%2Fpostings%2FRestful_In_Place_Editor%3F%26amp%3Bdepth%3D1%26amp%3Border%3D1%26amp%3Bsortby%3D2%26amp%3Brender%3Dflat" />
                        <input type="hidden" name="receipt[action]" value="reply" /> 
                        <input type="submit" name="submit" id="submit-reply349" value="Reply" />
                   </div>
               </form>

                <h4>Restful In Place Editor</h4>
<!-- show changelog -->
<!-- end changelog -->
           <span class="xar-sub">
 Posted by:                     linoj on                 February 29, 2008 11:43 AM</span>
       </div>
       <div class="xar-accent xar-cm-comment">
                Sven, i just found an alternative solution to mine, posted within days of this post, which may play better with the 2.0 forgery stuff 
<a href="http://www.bizmeetsdev.com/articles/2008/02/09/editable_content_tag" target="_blank">http://www.bizmeetsdev.com/articles/2008/02/09/editable_content_tag</a>                <p>
                    <a href="http://www.vaporbase.com/?module=comments&amp;func=display&amp;cid=349" title="Permalink" rel="bookmark">
                       #
                   </a>
               </p>

       </div>

</div>

    <div class="xar-accent-outline xar-cm-comment">
    <div>
         <a name="352"></a>
                <form action="http://www.vaporbase.com/?module=comments&amp;func=reply" method="post" class="xar-cm-actions">
                    <div>
                        <input type="hidden" name="header[modid]" value="151" />
                        <input type="hidden" name="header[itemtype]" value="9" />
                        <input type="hidden" name="header[objectid]" value="158" />
                        <input type="hidden" name="header[pid]" value="352" />
                        <input type="hidden" name="receipt[returnurl][decoded]" value="http://www.vaporbase.com/postings/Restful_In_Place_Editor?&amp;depth=1&amp;order=1&amp;sortby=2&amp;render=flat" />
                        <input type="hidden" name="receipt[returnurl][encoded]" value="http%3A%2F%2Fwww.vaporbase.com%2Fpostings%2FRestful_In_Place_Editor%3F%26amp%3Bdepth%3D1%26amp%3Border%3D1%26amp%3Bsortby%3D2%26amp%3Brender%3Dflat" />
                        <input type="hidden" name="receipt[action]" value="reply" /> 
                        <input type="submit" name="submit" id="submit-reply352" value="Reply" />
                   </div>
               </form>

                <h4>Restful In Place Editor</h4>
<!-- show changelog -->
<!-- end changelog -->
           <span class="xar-sub">
 Posted by:                     linoj on                 March 05, 2008 12:11 AM</span>
       </div>
       <div class="xar-accent xar-cm-comment">
                I'm adding this note (found on the rails wiki) although I havent tried it or integrated it into the helper: 

&quot;In rails 2.0, if you’re trying to submit some crazy AJAX you’ve coded manually and you’re getting an Invalid Authenticity Token error, be sure to add the following to the query string of parameters being submitted:

&amp;authenticity_token=&lt;%= form_authenticity_token %&gt;

form_authenticity_token will generate a valid token that rails needs to validate the request.                <p>
                    <a href="http://www.vaporbase.com/?module=comments&amp;func=display&amp;cid=352" title="Permalink" rel="bookmark">
                       #
                   </a>
               </p>

       </div>

</div>

    <div class="xar-accent-outline xar-cm-comment">
    <div>
         <a name="363"></a>
                <form action="http://www.vaporbase.com/?module=comments&amp;func=reply" method="post" class="xar-cm-actions">
                    <div>
                        <input type="hidden" name="header[modid]" value="151" />
                        <input type="hidden" name="header[itemtype]" value="9" />
                        <input type="hidden" name="header[objectid]" value="158" />
                        <input type="hidden" name="header[pid]" value="363" />
                        <input type="hidden" name="receipt[returnurl][decoded]" value="http://www.vaporbase.com/postings/Restful_In_Place_Editor?&amp;depth=1&amp;order=1&amp;sortby=2&amp;render=flat" />
                        <input type="hidden" name="receipt[returnurl][encoded]" value="http%3A%2F%2Fwww.vaporbase.com%2Fpostings%2FRestful_In_Place_Editor%3F%26amp%3Bdepth%3D1%26amp%3Border%3D1%26amp%3Bsortby%3D2%26amp%3Brender%3Dflat" />
                        <input type="hidden" name="receipt[action]" value="reply" /> 
                        <input type="submit" name="submit" id="submit-reply363" value="Reply" />
                   </div>
               </form>

                <h4>Restful In Place Editor</h4>
<!-- show changelog -->
<!-- end changelog -->
           <span class="xar-sub">
 Posted by:                     Anonymous on                 March 18, 2008 01:23 PM</span>
       </div>
       <div class="xar-accent xar-cm-comment">
                I just tried adding the authenticity_token to the string as you described above, and it works perfectly now.  A heck of a lot easier than the alternatives.  Any known security issues?

Anybody else wonder why in_place_editor would be considered &quot;crazy AJAX&quot; ?  Seems pretty mainstream to me...                <p>
                    <a href="http://www.vaporbase.com/?module=comments&amp;func=display&amp;cid=363" title="Permalink" rel="bookmark">
                       #
                   </a>
               </p>

       </div>

</div>

    <div class="xar-accent-outline xar-cm-comment">
    <div>
         <a name="371"></a>
                <form action="http://www.vaporbase.com/?module=comments&amp;func=reply" method="post" class="xar-cm-actions">
                    <div>
                        <input type="hidden" name="header[modid]" value="151" />
                        <input type="hidden" name="header[itemtype]" value="9" />
                        <input type="hidden" name="header[objectid]" value="158" />
                        <input type="hidden" name="header[pid]" value="371" />
                        <input type="hidden" name="receipt[returnurl][decoded]" value="http://www.vaporbase.com/postings/Restful_In_Place_Editor?&amp;depth=1&amp;order=1&amp;sortby=2&amp;render=flat" />
                        <input type="hidden" name="receipt[returnurl][encoded]" value="http%3A%2F%2Fwww.vaporbase.com%2Fpostings%2FRestful_In_Place_Editor%3F%26amp%3Bdepth%3D1%26amp%3Border%3D1%26amp%3Bsortby%3D2%26amp%3Brender%3Dflat" />
                        <input type="hidden" name="receipt[action]" value="reply" /> 
                        <input type="submit" name="submit" id="submit-reply371" value="Reply" />
                   </div>
               </form>

                <h4>Restful In Place Editor</h4>
<!-- show changelog -->
<!-- end changelog -->
           <span class="xar-sub">
 Posted by:                     Anonymous on                 April 12, 2008 12:24 AM</span>
       </div>
       <div class="xar-accent xar-cm-comment">
                Take a look at <a href="http://dev.rubyonrails.org/ticket/10055" target="_blank">http://dev.rubyonrails.org/ticket/10055</a> for an alternative solution for this problem.                <p>
                    <a href="http://www.vaporbase.com/?module=comments&amp;func=display&amp;cid=371" title="Permalink" rel="bookmark">
                       #
                   </a>
               </p>

       </div>

</div>

    <div class="xar-accent-outline xar-cm-comment">
    <div>
         <a name="392"></a>
                <form action="http://www.vaporbase.com/?module=comments&amp;func=reply" method="post" class="xar-cm-actions">
                    <div>
                        <input type="hidden" name="header[modid]" value="151" />
                        <input type="hidden" name="header[itemtype]" value="9" />
                        <input type="hidden" name="header[objectid]" value="158" />
                        <input type="hidden" name="header[pid]" value="392" />
                        <input type="hidden" name="receipt[returnurl][decoded]" value="http://www.vaporbase.com/postings/Restful_In_Place_Editor?&amp;depth=1&amp;order=1&amp;sortby=2&amp;render=flat" />
                        <input type="hidden" name="receipt[returnurl][encoded]" value="http%3A%2F%2Fwww.vaporbase.com%2Fpostings%2FRestful_In_Place_Editor%3F%26amp%3Bdepth%3D1%26amp%3Border%3D1%26amp%3Bsortby%3D2%26amp%3Brender%3Dflat" />
                        <input type="hidden" name="receipt[action]" value="reply" /> 
                        <input type="submit" name="submit" id="submit-reply392" value="Reply" />
                   </div>
               </form>

                <h4>Restful In Place Editor</h4>
<!-- show changelog -->
<!-- end changelog -->
           <span class="xar-sub">
 Posted by:                     Anonymous on                 June 21, 2008 10:31 PM</span>
       </div>
       <div class="xar-accent xar-cm-comment">
                Nice patch, but there is a problem with multi-bytes characters in the value. It could be avoided by using encodeURIComponent() instead of escape().
- js_options['callback']   = &quot;function(form,value) { return '#{options[:as]}=' + escape(value) }&quot; if options[:as]
+ js_options['callback']   = &quot;function(form,value) { return '#{options[:as]}=' + encodeURIComponent(value) }&quot; if options[:as]

                <p>
                    <a href="http://www.vaporbase.com/?module=comments&amp;func=display&amp;cid=392" title="Permalink" rel="bookmark">
                       #
                   </a>
               </p>

       </div>

</div>

    <div class="xar-accent-outline xar-cm-comment">
    <div>
         <a name="395"></a>
                <form action="http://www.vaporbase.com/?module=comments&amp;func=reply" method="post" class="xar-cm-actions">
                    <div>
                        <input type="hidden" name="header[modid]" value="151" />
                        <input type="hidden" name="header[itemtype]" value="9" />
                        <input type="hidden" name="header[objectid]" value="158" />
                        <input type="hidden" name="header[pid]" value="395" />
                        <input type="hidden" name="receipt[returnurl][decoded]" value="http://www.vaporbase.com/postings/Restful_In_Place_Editor?&amp;depth=1&amp;order=1&amp;sortby=2&amp;render=flat" />
                        <input type="hidden" name="receipt[returnurl][encoded]" value="http%3A%2F%2Fwww.vaporbase.com%2Fpostings%2FRestful_In_Place_Editor%3F%26amp%3Bdepth%3D1%26amp%3Border%3D1%26amp%3Bsortby%3D2%26amp%3Brender%3Dflat" />
                        <input type="hidden" name="receipt[action]" value="reply" /> 
                        <input type="submit" name="submit" id="submit-reply395" value="Reply" />
                   </div>
               </form>

                <h4>Restful In Place Editor</h4>
<!-- show changelog -->
<!-- end changelog -->
           <span class="xar-sub">
 Posted by:                     Anonymous on                 June 23, 2008 06:04 PM</span>
       </div>
       <div class="xar-accent xar-cm-comment">
                Can you help explain the last line in your controller?  

render :text =&gt; self.class.attributes.include? attribute ? @foo[attribute] : '(bad attribute)'

This doesn't even allow the page to load for me, and I'm trying to figure out what we're actually doing and what I need to change for my situation.  I basically just changed @foo to @contact, but I think I'm missing something.                <p>
                    <a href="http://www.vaporbase.com/?module=comments&amp;func=display&amp;cid=395" title="Permalink" rel="bookmark">
                       #
                   </a>
               </p>

       </div>

</div>

    <div class="xar-accent-outline xar-cm-comment">
    <div>
         <a name="514"></a>
                <form action="http://www.vaporbase.com/?module=comments&amp;func=reply" method="post" class="xar-cm-actions">
                    <div>
                        <input type="hidden" name="header[modid]" value="151" />
                        <input type="hidden" name="header[itemtype]" value="9" />
                        <input type="hidden" name="header[objectid]" value="158" />
                        <input type="hidden" name="header[pid]" value="514" />
                        <input type="hidden" name="receipt[returnurl][decoded]" value="http://www.vaporbase.com/postings/Restful_In_Place_Editor?&amp;depth=1&amp;order=1&amp;sortby=2&amp;render=flat" />
                        <input type="hidden" name="receipt[returnurl][encoded]" value="http%3A%2F%2Fwww.vaporbase.com%2Fpostings%2FRestful_In_Place_Editor%3F%26amp%3Bdepth%3D1%26amp%3Border%3D1%26amp%3Bsortby%3D2%26amp%3Brender%3Dflat" />
                        <input type="hidden" name="receipt[action]" value="reply" /> 
                        <input type="submit" name="submit" id="submit-reply514" value="Reply" />
                   </div>
               </form>

                <h4>Restful In Place Editor</h4>
<!-- show changelog -->
<!-- end changelog -->
           <span class="xar-sub">
 Posted by:                     Anonymous on                 December 11, 2008 07:08 AM</span>
       </div>
       <div class="xar-accent xar-cm-comment">
                Thank you for the patch.

As far as I can tell your line in the in_place_editor helper overwrites any existing js_options['callback']  as for example introduced when applying the patch <a href="http://dev.rubyonrails.org/ticket/10055." target="_blank">http://dev.rubyonrails.org/ticket/10055.</a> 

Using the following gets rid of that:

<pre>if options[:as]
      options[:with] ||= &quot;Form.serialize(form)&quot;
      options[:with] += &quot; + '&amp;#{options[:as]}=' + encodeURIComponent(value)&quot;
    end
</pre>                <p>
                    <a href="http://www.vaporbase.com/?module=comments&amp;func=display&amp;cid=514" title="Permalink" rel="bookmark">
                       #
                   </a>
               </p>

       </div>

</div>

    <div class="xar-accent-outline xar-cm-comment">
    <div>
         <a name="515"></a>
                <form action="http://www.vaporbase.com/?module=comments&amp;func=reply" method="post" class="xar-cm-actions">
                    <div>
                        <input type="hidden" name="header[modid]" value="151" />
                        <input type="hidden" name="header[itemtype]" value="9" />
                        <input type="hidden" name="header[objectid]" value="158" />
                        <input type="hidden" name="header[pid]" value="515" />
                        <input type="hidden" name="receipt[returnurl][decoded]" value="http://www.vaporbase.com/postings/Restful_In_Place_Editor?&amp;depth=1&amp;order=1&amp;sortby=2&amp;render=flat" />
                        <input type="hidden" name="receipt[returnurl][encoded]" value="http%3A%2F%2Fwww.vaporbase.com%2Fpostings%2FRestful_In_Place_Editor%3F%26amp%3Bdepth%3D1%26amp%3Border%3D1%26amp%3Bsortby%3D2%26amp%3Brender%3Dflat" />
                        <input type="hidden" name="receipt[action]" value="reply" /> 
                        <input type="submit" name="submit" id="submit-reply515" value="Reply" />
                   </div>
               </form>

                <h4>Re: Restful In Place Editor</h4>
<!-- show changelog -->
<!-- end changelog -->
           <span class="xar-sub">
 Posted by:                     Anonymous on                 December 11, 2008 08:49 AM</span>
       </div>
       <div class="xar-accent xar-cm-comment">
                Handling the data with RJS still raises the problem that after updating the value, the javascript of the RJS is displayed instead of the updated value. I tried to outline the solution to that at <a href="http://schotte.twoday.net/stories/5381459/" target="_blank">http://schotte.twoday.net/stories/5381459/</a>                <p>
                    <a href="http://www.vaporbase.com/?module=comments&amp;func=display&amp;cid=515" title="Permalink" rel="bookmark">
                       #
                   </a>
               </p>

       </div>

</div>

    <div class="xar-accent-outline xar-cm-comment">
    <div>
         <a name="569"></a>
                <form action="http://www.vaporbase.com/?module=comments&amp;func=reply" method="post" class="xar-cm-actions">
                    <div>
                        <input type="hidden" name="header[modid]" value="151" />
                        <input type="hidden" name="header[itemtype]" value="9" />
                        <input type="hidden" name="header[objectid]" value="158" />
                        <input type="hidden" name="header[pid]" value="569" />
                        <input type="hidden" name="receipt[returnurl][decoded]" value="http://www.vaporbase.com/postings/Restful_In_Place_Editor?&amp;depth=1&amp;order=1&amp;sortby=2&amp;render=flat" />
                        <input type="hidden" name="receipt[returnurl][encoded]" value="http%3A%2F%2Fwww.vaporbase.com%2Fpostings%2FRestful_In_Place_Editor%3F%26amp%3Bdepth%3D1%26amp%3Border%3D1%26amp%3Bsortby%3D2%26amp%3Brender%3Dflat" />
                        <input type="hidden" name="receipt[action]" value="reply" /> 
                        <input type="submit" name="submit" id="submit-reply569" value="Reply" />
                   </div>
               </form>

                <h4>Restful In Place Editor</h4>
<!-- show changelog -->
<!-- end changelog -->
           <span class="xar-sub">
 Posted by:                     Anonymous on                 April 06, 2009 03:21 PM</span>
       </div>
       <div class="xar-accent xar-cm-comment">
                SVN url is not working.                 <p>
                    <a href="http://www.vaporbase.com/?module=comments&amp;func=display&amp;cid=569" title="Permalink" rel="bookmark">
                       #
                   </a>
               </p>

       </div>

</div>

<script type="text/javascript" src="modules/base/xartemplates/includes/submitonce.js"></script>
  <h3>Post a new comment</h3> 
  <form action="http://www.vaporbase.com/?module=comments&amp;func=reply" method="post" name="post" id="post" onSubmit="submitonce(this)" id="post"
 >
   <div class="xar-ib-wrapper xar-accent-outline">
<div class="xar-ib-actionpanel xar-accent">
         <span>
 BBCode Actions             : 
          </span>
          <span>
            <!-- New xaraya style link tag <xar:set name="$stylesheet">xarTplAddStyleLink('bbcode', 'bbcode')</xar:set> -->

<span>
    <input type="button" accesskey="z" name="addbbcode18" value=" p " onclick="bbstyle(18)" onmouseover="document.post.helpbox.value='Paragraph: [p]text[/p] (alt+z)'; return true" />
    <input type="button" accesskey="b" name="addbbcode0" value=" b " style="font-weight:bold;" onclick="bbstyle(0)" onmouseover="document.post.helpbox.value='Bold text: [b]text[/b] (alt+b)'; return true" />
    <input type="button" accesskey="i" name="addbbcode2" value=" i " style="font-style:italic;" onclick="bbstyle(2)" onmouseover="document.post.helpbox.value='Italic text: [i]text[/i] (alt+i)'; return true" />
    <input type="button" accesskey="u" name="addbbcode4" value=" u " style="font-style: underline;" onclick="bbstyle(4)" onmouseover="document.post.helpbox.value='Underline text: [u]text[/u] (alt+u)'; return true" />
    <input type="button" accesskey="q" name="addbbcode6" value="Quote" onclick="bbstyle(6)" onmouseover="document.post.helpbox.value='Quote text: [quote]text[/quote] (alt+q)'; return true" />
    <input type="button" accesskey="c" name="addbbcode8" value="Code" onclick="bbstyle(8)" onmouseover="document.post.helpbox.value='Code display: [code=xml]code[/code] (alt+c)'; return true" />
    <input type="button" accesskey="p" name="addbbcode14" value="Img" onclick="bbstyle(14)" onmouseover="document.post.helpbox.value='Insert image: [img]http://image_url[/img] (alt+p)'; return true" />
    <input type="button" accesskey="w" name="addbbcode16" value="URL" style="text-decoration: underline;" onclick="bbstyle(16)" onmouseover="document.post.helpbox.value='Insert URL: [url]http://url[/url] or [url=http://url]URL text[/url] (alt+w)'; return true" />
</span>
<label for="addbbcode20">
 Font color     :
</label>
<select name="addbbcode20" onchange="bbfontstyle('[color=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/color]');this.selectedIndex=0;" onmouseover="document.post.helpbox.value='Font color: [color=red]text[/color] Tip: you can also use color=#FF0000'; return true">
   <option style="color:black; background-color: #FAFAFA" value="#444444" class="xar-bbcode-genmed">
 Default </option>
   <option style="color:darkred; background-color: #FAFAFA" value="darkred" class="xar-bbcode-genmed">
 Dark Red </option>
   <option style="color:red; background-color: #FAFAFA" value="red" class="xar-bbcode-genmed">
 Red </option>
   <option style="color:orange; background-color: #FAFAFA" value="orange" class="xar-bbcode-genmed">
 Orange </option>
   <option style="color:brown; background-color: #FAFAFA" value="brown" class="xar-bbcode-genmed">
 Brown </option>
   <option style="color:yellow; background-color: #FAFAFA" value="yellow" class="xar-bbcode-genmed">
 Yellow </option>
   <option style="color:green; background-color: #FAFAFA" value="green" class="xar-bbcode-genmed">
 Green </option>
   <option style="color:olive; background-color: #FAFAFA" value="olive" class="xar-bbcode-genmed">
 Olive </option>
   <option style="color:cyan; background-color: #FAFAFA" value="cyan" class="xar-bbcode-genmed">
 Cyan </option>
   <option style="color:blue; background-color: #FAFAFA" value="blue" class="xar-bbcode-genmed">
 Blue </option>
   <option style="color:darkblue; background-color: #FAFAFA" value="darkblue" class="xar-bbcode-genmed">
 Dark Blue </option>
   <option style="color:indigo; background-color: #FAFAFA" value="indigo" class="xar-bbcode-genmed">
 Indigo </option>
   <option style="color:violet; background-color: #FAFAFA" value="violet" class="xar-bbcode-genmed">
 Violet </option>
   <option style="color:white; background-color: #FAFAFA" value="white" class="xar-bbcode-genmed">
 White </option>
   <option style="color:black; background-color: #FAFAFA" value="black" class="xar-bbcode-genmed">
 Black </option>
</select>
<label for="addbbcode22">
 Font size     :
</label>
<select name="addbbcode22" onchange="bbfontstyle('[size=' + this.form.addbbcode22.options[this.form.addbbcode22.selectedIndex].value + ']', '[/size]')" onmouseover="document.post.helpbox.value='Font size: [size=x-small]small text[/size]'; return true">
   <option value="7" class="xar-bbcode-genmed">
 Tiny </option>
   <option value="9" class="xar-bbcode-genmed">
 Small </option>
   <option value="12" selected="selected" class="xar-bbcode-genmed">
 Normal </option>
   <option value="18" class="xar-bbcode-genmed">
 Large </option>
   <option value="24" class="xar-bbcode-genmed">
 Huge     </option>
</select>
<a href="javascript:bbstyle(-1)" class="xar-bbcode-genmed" onmouseover="document.post.helpbox.value='Close all open bbCode tags'; return true">Close Tags</a>
<span class="gensmall">
    <input type="text" name="helpbox" size="50" maxlength="100" class="helpline" value="Tip: Styles can be applied quickly to selected text." />
</span>         </span>
       </div>
       <div class="xar-ib-leftpanelshort">
         <p>
 Name :
              Anonymous</p>
         <label for="package-title">
 Title: </label>
            <input class="xar-ib-field" type="text" name="package[title]" id="package-title" value="Restful In Place Editor" tabindex="1" />
         <label for="package-text">
 Comment: </label>
<textarea class="xar-ib-fieldtext" name="package[text]" id="package-text" tabindex="2"></textarea>

          <input type="hidden" name="header[modid]" id="header-modid" value="151" /> 
          <input type="hidden" name="header[objectid]" id="header-objectid" value="158" /> 
          <input type="hidden" name="header[itemtype]" id="header-itemtype" value="9" />
<input type="hidden" name="header[pid]" id="header-pid" value="0" />
          <input type="hidden" name="receipt[returnurl][decoded]" id="receipt-returnurl-decoded" value="http://www.vaporbase.com/postings/Restful_In_Place_Editor?&amp;depth=1&amp;order=1&amp;sortby=2&amp;render=flat" />
          <!--<input type="hidden" name="receipt[returnurl][encoded]" id="receipt-returnurl-encoded" value="#$receipt['returnurl']['encoded']#" />-->
          <input type="hidden" name="receipt[action]" id="receipt-action" /> 
          <input type="submit" id="receipt-action-preview" onclick="document.getElementById('receipt-action').value='preview'" value="Preview" /> 
          <input type="submit" id="receipt-action-submit" onclick="document.getElementById('receipt-action').value='submit'" value="Submit" />
       </div>
</div>
 </form>
</p>
        <p></p>
        <p><br/>
<b>Keywords :</b>
<div style="margin-left: 1em; margin-right: 1em; text-align:left;">
    <li><a href="http://www.vaporbase.com/keywords/in_place_editor/">in_place_editor</a></li>
    <li><a href="http://www.vaporbase.com/keywords/REST/">REST</a></li>
</div>
<br/>

</p>
</div>
   </channel>
</rss>
