def resource_count resource
        dupped_resource = resource.dup

        to_remove = dupped_resource.reflect_on_all_associations
                                   .select{|a| a.options[:polymorphic]}
                                   .map &:name
        dupped_resource.includes_values -= to_remove

        return dupped_resource.count
      end
def resource_count resource
        dupped_resource = resource.dup

        to_remove = dupped_resource.reflect_on_all_associations
                                   .select{|a| a.options[:polymorphic]}
                                   .map &:name
        dupped_resource.includes_values -= to_remove

        return dupped_resource.count
      end
=============================================================================