friendly_id 4.0.8 → 4.0.9

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
+ ## 4.0.9 (2012-10-31)
10
+
11
+ * Fixed support for Rails 3.2.9.rc1
12
+
9
13
  ## 4.0.8 (2012-08-01)
10
14
 
11
15
  * Name internal anonymous class to fix marshall dump/load error (Jess Brown, Philip Arndt and Norman Clarke).
data/Guide.rdoc CHANGED
@@ -114,8 +114,8 @@ store them in a field in your model. By default, this field must be named
114
114
  +:slug+, though you may change this using the
115
115
  {FriendlyId::Slugged::Configuration#slug_column slug_column} configuration
116
116
  option. You should add an index to this column, and in most cases, make it
117
- unique. Do not make the column unique in case you wish to scope the slug
118
- (more on this later). You may also wish to constrain it to NOT NULL, but this
117
+ unique. Do not make the column unique in case you wish to scope the slug
118
+ (more on this later). You may also wish to constrain it to NOT NULL, but this
119
119
  depends on your app's behavior and requirements.
120
120
 
121
121
  === Example Setup
@@ -316,7 +316,7 @@ method.
316
316
  ...
317
317
 
318
318
  def find_post
319
- Post.find params[:id]
319
+ @post = Post.find params[:id]
320
320
 
321
321
  # If an old id or a numeric id was used to find the record, then
322
322
  # the request path will not match the post_path, and we should do
data/lib/friendly_id.rb CHANGED
@@ -45,7 +45,7 @@ with numeric ids:
45
45
  module FriendlyId
46
46
 
47
47
  # The current version.
48
- VERSION = "4.0.8"
48
+ VERSION = "4.0.9"
49
49
 
50
50
  @mutex = Mutex.new
51
51
 
@@ -207,12 +207,24 @@ often better and easier to use {FriendlyId::Slugged slugs}.
207
207
 
208
208
  private
209
209
 
210
- # Gets an instance of an anonymous subclass of ActiveRecord::Relation.
210
+ # Gets an instance of an the relation class.
211
+ #
212
+ # With FriendlyId this will be a subclass of ActiveRecord::Relation, rather than
213
+ # Relation itself, in order to avoid tainting all Active Record models with
214
+ # FriendlyId.
215
+ #
216
+ # Note that this method is essentially copied and pasted from Rails 3.2.9.rc1,
217
+ # with the exception of changing the relation class. Obviously this is less than
218
+ # ideal, but I know of no better way to accomplish this.
211
219
  # @see #relation_class
212
- def relation
213
- @relation = nil unless @relation.class <= relation_class
214
- @relation ||= relation_class.new(self, arel_table)
215
- super
220
+ def relation #:nodoc:
221
+ relation = relation_class.new(self, arel_table)
222
+
223
+ if finder_needs_type_condition?
224
+ relation.where(type_condition).create_with(inheritance_column.to_sym => sti_name)
225
+ else
226
+ relation
227
+ end
216
228
  end
217
229
 
218
230
  # Gets (and if necessary, creates) a subclass of the model's relation class.
@@ -43,7 +43,7 @@ method.
43
43
  ...
44
44
 
45
45
  def find_post
46
- Post.find params[:id]
46
+ @post = Post.find params[:id]
47
47
 
48
48
  # If an old id or a numeric id was used to find the record, then
49
49
  # the request path will not match the post_path, and we should do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: friendly_id
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.8
4
+ version: 4.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-08-01 00:00:00.000000000 Z
13
+ date: 2012-11-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: railties
@@ -260,18 +260,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
260
260
  - - ! '>='
261
261
  - !ruby/object:Gem::Version
262
262
  version: '0'
263
- segments:
264
- - 0
265
- hash: -4530033734929849472
266
263
  required_rubygems_version: !ruby/object:Gem::Requirement
267
264
  none: false
268
265
  requirements:
269
266
  - - ! '>='
270
267
  - !ruby/object:Gem::Version
271
268
  version: '0'
272
- segments:
273
- - 0
274
- hash: -4530033734929849472
275
269
  requirements: []
276
270
  rubyforge_project: friendly_id
277
271
  rubygems_version: 1.8.24