We do a lot of polymorphic stuff like this where I work. Just a suggestion:
instead of
eval("#{item.class.to_s.downcase}_comments_path(#{item.id})")
try
send("#{item.class.to_s.downcase}_comments_path", item.id))
Or, wrap it up:
def polymorphic_comments_path(item)
send("#{item.class.to_s.underscore}_comments_path", item))
end
If you find yourself using eval, there's usually another way to do it in Ruby.