I’m having a weird error in my haml views. When I ask for model.id it returns object_id but only in some places. Example:
%ul
- @items.each do |item|
%li{:class => "item", :id => "item_#{item.id}"}= link_to(item.name,item)
The code above renders this:
<ul>
<li class="item" id="item_104589"><a href="/items/1">Test1</a></li>
<li class="item" id="item_104590"><a href="/items/2">Test2</a></li>
</ul>
I said this is a weird error because it’s only happening on production environment and links are correct.
The array of items are “decorated” using Drapper gem. I’m not using the short form of haml because of this:
%li[item]
Renders:
<li class="item_decorator" id="item_decorator_xxx">...</li>
thanks to Leonid, I found the problem with
ItemDecorator.ItemDecoratoroverride the methodidfrom classItem:I wonder if it is a bug of Drapper or not.