slugoid 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,8 +9,8 @@ module Mongoid::Criterion::Optional
9
9
  #
10
10
  alias :for_ids! :for_ids
11
11
  def for_ids(*ids)
12
- unless ids.first.is_a?(BSON::ObjectId)
13
- ids.flatten!
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?)
@@ -1,5 +1,5 @@
1
1
  module Acts
2
2
  module Slugoid
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -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 = Project.create!
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
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: slugoid
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.0
5
+ version: 0.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - David Padilla