lib/slugoid/mongoid/criterion/optional.rb in slugoid-0.0.4 vs lib/slugoid/mongoid/criterion/optional.rb in slugoid-0.0.5
- old
+ new
@@ -7,11 +7,11 @@
#
# where(:_id => some_id)
#
alias :id! :id
def id(*ids)
- if @klass.respond_to?(:acts_as_slugoid_options)
+ unless ids.first.is_a?(BSON::ObjectId)
ids.flatten!
if ids.size > 1
self.in(
@klass.acts_as_slugoid_options[:store_as] => ::BSON::ObjectId.cast!(@klass, ids, @klass.primary_key.nil?)
)
@@ -21,6 +21,6 @@
self
else
id!(*ids)
end
end
-end
\ No newline at end of file
+end