friendly_id 3.1.0 → 3.1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Changelog.md CHANGED
@@ -6,6 +6,10 @@ suggestions, ideas and improvements to FriendlyId.
6
6
  * Table of Contents
7
7
  {:toc}
8
8
 
9
+ ## 3.1.1 (2010-07-30)
10
+
11
+ * Fixed call to method on nil value for failing unfriendly finds (thanks [jlippiner](http://github.com/jlippiner))
12
+
9
13
  ## 3.1.0 (2010-07-29)
10
14
 
11
15
  * Refactored/simplified Active Record 2 and 3 query code.
@@ -3,7 +3,6 @@ module FriendlyId
3
3
  module Finders
4
4
 
5
5
  class Find
6
-
7
6
  extend Forwardable
8
7
  def_delegators :@klass, :scoped, :friendly_id_config, :quoted_table_name, :table_name, :primary_key,
9
8
  :connection, :name, :sanitize_sql
@@ -147,7 +146,7 @@ module FriendlyId
147
146
  finder = Find.new(self, id, options)
148
147
  finder.find_one or super
149
148
  rescue ActiveRecord::RecordNotFound => error
150
- finder.raise_error(error)
149
+ finder ? finder.raise_error(error) : raise(error)
151
150
  end
152
151
 
153
152
  def find_some(ids, options)
@@ -155,7 +154,7 @@ module FriendlyId
155
154
  finder = Find.new(self, ids, options)
156
155
  finder.find_some
157
156
  rescue ActiveRecord::RecordNotFound => error
158
- finder.raise_error(error)
157
+ finder ? finder.raise_error(error) : raise(error)
159
158
  end
160
159
  end
161
160
  end
@@ -94,6 +94,12 @@ module FriendlyId
94
94
  assert_equal instance, klass.send(find_method, "206")
95
95
  end
96
96
 
97
+ test "failing finds with unfriendly_id should raise errors normally" do
98
+ assert_raise ActiveRecord::RecordNotFound do
99
+ klass.send(find_method, 0)
100
+ end
101
+ end
102
+
97
103
  test "creation should raise an error if the friendly_id text is reserved" do
98
104
  assert_validation_error do
99
105
  klass.send(create_method, :name => "new")
@@ -2,8 +2,8 @@ module FriendlyId
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 1
5
- TINY = 0
6
- BUILD = nil
5
+ TINY = 1
6
+ BUILD = 1
7
7
  STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
8
8
  end
9
9
  end
@@ -52,6 +52,12 @@ module FriendlyId
52
52
  assert_equal 2, klass.find([instance.friendly_id, second.friendly_id]).size
53
53
  end
54
54
 
55
+ test "failing finds with array of unfriendly_id should raise errors normally" do
56
+ assert_raise ActiveRecord::RecordNotFound do
57
+ klass.find([0, -1])
58
+ end
59
+ end
60
+
55
61
  test "instances should be findable by an array of numeric ids" do
56
62
  second = klass.create!(:name => "second_instance")
57
63
  third = klass.create!(:name => "third_instance")
metadata CHANGED
@@ -5,8 +5,9 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 3
7
7
  - 1
8
- - 0
9
- version: 3.1.0
8
+ - 1
9
+ - 1
10
+ version: 3.1.1.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Norman Clarke
@@ -16,7 +17,7 @@ autorequire:
16
17
  bindir: bin
17
18
  cert_chain: []
18
19
 
19
- date: 2010-07-29 00:00:00 -03:00
20
+ date: 2010-07-30 00:00:00 -03:00
20
21
  default_executable:
21
22
  dependencies:
22
23
  - !ruby/object:Gem::Dependency