Register now and start sharing your code snippets.
-->

How to fix "Only get, head, post, put, and delete requests are allowed."

Ruby posted 2 months ago by christian

I’m getting this once in a while in development mode after changing the routes configuration:

   1  ActionController::MethodNotAllowed
   2  
   3  Only get, head, post, put, and delete requests are allowed.

The solution for me has been to restart the server.

Tagged bug, rails, problem, fix

Hpricot's inner_text doesn't handle HTML entities correctly

Ruby posted 7 months ago by christian

Hpricot’s inner_text method is fubar and doesn’t handle HTML entities correctly, instead you’ll see questionmarks in the output. To fix this replace calls to Hpricot’s inner_text with a call to the following method (or Monkey patch Hpricot):

   1  require 'rubygems'
   2  require 'htmlentities'
   3  
   4    def inner_text(node)
   5       text = node.innerHTML.gsub(%r{<.*?>}, "").strip
   6       HTMLEntities.new.decode(text)
   7    end

Remember to install the htmlentities gem:

   1  sudo gem install htmlentities

Tagged hpricot, inner_text, problem, bug

Solving "Internet Explorer cannot open the Internet site http://xyz.com. Operation aborted."

JavaScript posted about 1 year ago by christian

This bug exists in IE6 and IE7 and is caused by a JavaScript that tries to modify a tag that hasn’t been closed (yet).

For example this one:

   1  <div id="x">
   2    <script type="text/javascript">
   3    $('x').replace("wrong");
   4    </script>
   5  </div>

This example fixes the problem, because the script is defined after the tag that it tries to modify:

   1  <div id="x">
   2  </div>
   3  <script type="text/javascript">
   4    $('x').replace("correct");
   5  </script>

See BUG : Error message when you visit a Web page or interact with a Web application in Internet Explorer: ‘Operation aborted’ for a detailed explanation of the problem.

Tagged ie6, ie7, bug, ajax, prototype, scriptaculous