Your original method was better (IMHO) – @item.class.find(params[:id])
– as type is deprecated and can sometimes behave unexpectedly as it’s
used as the key in STI models.
Also wanted to check you knew that @items.pop is a destructive method,
i.e. the item is removed from @items.
I would wonder if @items.last.class.find(params[:id]) is perhaps a bit
You’ve prob figured now that undefined method `find’ for NilClass:Class
was happening because @item was nil (instance variables are nil when
they are undefined, unlike local variables – try p @item and p item in
the console), and the class of nil is NilClass, which obviously doesn’t
have a find method.