lib/spatial_features/utils.rb in spatial_features-2.4.0 vs lib/spatial_features/utils.rb in spatial_features-2.4.1
- old
+ new
@@ -14,17 +14,22 @@
case object
when ActiveRecord::Base
object.class
when ActiveRecord::Relation
object.klass
+ when String
+ object.constantize
else
object
end
end
def id_sql(object)
- if object.is_a?(ActiveRecord::Base)
+ case object
+ when ActiveRecord::Base
object.id || '0'
+ when String
+ id_sql(object.constantize)
else
object.unscope(:select).select(:id).to_sql
end
end
end