def class_of(object)
      case object
      when ActiveRecord::Base
        object.class
      when ActiveRecord::Relation
        object.klass
      when String
        object.constantize
      else
        object
      end
    end
def class_of(object)
      case object
      when ActiveRecord::Base
        object.class
      when ActiveRecord::Relation
        object.klass
      when String
        object.constantize
      else
        object
      end
    end
Returns the class for the given, class, scope, or record