Skip to content
Browse files

Fixes bad call to apply_mapping on 2.3.

  • Loading branch information...
1 parent bb7b20d commit ca9821192c8c3c4e81a938603151645c7cbe1470 @norman norman committed
Showing with 14 additions and 4 deletions.
  1. +4 −0 Changelog.md
  2. +8 −2 lib/friendly_id/slug_string.rb
  3. +1 −1 lib/friendly_id/version.rb
  4. +1 −1 test/active_record_adapter/ar_test_helper.rb
View
4 Changelog.md
@@ -6,6 +6,10 @@ suggestions, ideas and improvements to FriendlyId.
* Table of Contents
{:toc}
+## 3.0.6 (2010-06-10)
+
+* Fix bad call to apply_mapping on 2.3.
+
## 3.0.5 (2010-06-10)
* Fixed support for Rails 3.0 beta4 (Bruno Michel)
View
10 lib/friendly_id/slug_string.rb
@@ -206,7 +206,13 @@ def clean!
# though your milage may vary with Greek and Turkic strings.
# @return String
def downcase!
- @wrapped_string = ActiveSupport::Multibyte::Unicode.apply_mapping(@wrapped_string, :lowercase_mapping)
+ @wrapped_string = apply_mapping :lowercase_mapping
+ end
+
+ if defined? ActiveSupport::Multibyte::Unicode
+ def apply_mapping(*args)
+ ActiveSupport::Multibyte::Unicode.apply_mapping(@wrapped_string, *args)
+ end
end
# Remove any non-word characters.
@@ -333,7 +339,7 @@ def truncate!(max)
# though your milage may vary with Greek and Turkic strings.
# @return String
def upcase!
- @wrapped_string = ActiveSupport::Multibyte::Unicode.apply_mapping(@wrapped_string, :uppercase_mapping)
+ @wrapped_string = apply_mapping :uppercase_mapping
end
# Validate that the slug string is not blank or reserved, and truncate
View
2 lib/friendly_id/version.rb
@@ -2,7 +2,7 @@ module FriendlyId
module Version
MAJOR = 3
MINOR = 0
- TINY = 5
+ TINY = 6
BUILD = nil
STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
end
View
2 test/active_record_adapter/ar_test_helper.rb
@@ -38,7 +38,7 @@ class District < ActiveRecord::Base
class Region < ActiveRecord::Base
has_friendly_id :name, :use_slug => true
after_create do |obj|
- other_instance = self.class.find obj.id
+ other_instance = Region.find obj.id
other_instance.update_attributes :note => name + "!"
end
end

0 comments on commit ca98211

Please sign in to comment.
Something went wrong with that request. Please try again.