One of the downsides to Rails' automatic method generation is that sometimes it bites you in the butt.

I've been tearing my hair out trying to figure out why ActionView::Helpers::AssetTagHelper.image_path was behaving strangely all of a sudden.  It didn't help that I had a boatload of local changes and there were multiple layers causing problems.  I am using the Rails Engines plugin, which was alias_method_chaining that method, and I thought the problem was in the aliasing.  But the other AssetTagHelper methods (stylesheet_link_tag, javascript_include_tag, and image_tag) were all correctly aliased and working fine.

It turns out that when I created a RESTful route for my new Image ActiveRecord class that it automatically created an image_path method, overriding the normal one.

I'm going to go look for some glue to see if I can get this hair to stick back on my head.
 


Comments




Leave a Reply