slugoid 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -9,8 +9,8 @@ module Mongoid::Criterion::Optional
|
|
9
9
|
#
|
10
10
|
alias :for_ids! :for_ids
|
11
11
|
def for_ids(*ids)
|
12
|
-
|
13
|
-
|
12
|
+
ids.flatten!
|
13
|
+
if @klass.respond_to?(:acts_as_slugoid_options) && !ids.first.is_a?(BSON::ObjectId)
|
14
14
|
if ids.size > 1
|
15
15
|
self.in(
|
16
16
|
@klass.acts_as_slugoid_options[:store_as] => ::BSON::ObjectId.cast!(@klass, ids, @klass.primary_key.nil?)
|
data/lib/slugoid/version.rb
CHANGED
@@ -10,7 +10,7 @@ module Acts::Slugoid::Test
|
|
10
10
|
def setup
|
11
11
|
setup!
|
12
12
|
@slugoid_project = SlugoidProject.create!(:name => 'Scott')
|
13
|
-
@project
|
13
|
+
@project = Project.create!(:name => 'Bauer')
|
14
14
|
end
|
15
15
|
|
16
16
|
context "find" do
|
@@ -18,6 +18,12 @@ module Acts::Slugoid::Test
|
|
18
18
|
assert_equal(@slugoid_project, SlugoidProject.find(@slugoid_project.to_param))
|
19
19
|
assert_equal(@slugoid_project, SlugoidProject.find(@slugoid_project.id))
|
20
20
|
end
|
21
|
+
|
22
|
+
should "work as usual for other models" do
|
23
|
+
assert_equal @project, Project.find(@project.id)
|
24
|
+
assert_equal @project, Project.find(:first, :conditions => {:name => @project.name})
|
25
|
+
assert_equal @project, Project.first(:conditions => {:name => @project.name})
|
26
|
+
end
|
21
27
|
end
|
22
28
|
|
23
29
|
context "explicit find by id" do
|