friendly_id_globalize3 3.2.1.2 → 3.2.1.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,7 @@ module FriendlyId
|
|
6
6
|
base.class_eval do
|
7
7
|
has_many :slugs, :order => 'id DESC', :as => :sluggable, :dependent => :destroy
|
8
8
|
has_one :slug, :order => 'id DESC', :as => :sluggable, :dependent => :destroy,
|
9
|
-
:conditions => (proc{ {:locale =>
|
9
|
+
:conditions => (proc{ {:locale => (Thread.current[:globalize_locale] || ::I18n.locale)} } if friendly_id_config.class.locales_used?)
|
10
10
|
before_save :build_a_slug
|
11
11
|
after_save :set_slug_cache
|
12
12
|
after_update :update_scope
|
@@ -44,7 +44,7 @@ module FriendlyId
|
|
44
44
|
unless friendly_id_config.class.locales_used?
|
45
45
|
slug? ? slug.to_friendly_id : id.to_s
|
46
46
|
else
|
47
|
-
if (locale_slug = slugs.detect{|s| s.locale.to_s ==
|
47
|
+
if (locale_slug = slugs.detect{|s| s.locale.to_s == (Thread.current[:globalize_locale] || ::I18n.locale).to_s}).present?
|
48
48
|
locale_slug.to_friendly_id
|
49
49
|
else
|
50
50
|
id.to_s
|
@@ -56,8 +56,8 @@ module FriendlyId
|
|
56
56
|
def build_a_slug
|
57
57
|
return unless new_slug_needed?
|
58
58
|
@slug = slugs.build :name => slug_text.to_s, :scope => friendly_id_config.scope_for(self),
|
59
|
-
|
60
|
-
@slug.locale =
|
59
|
+
:sluggable => self
|
60
|
+
@slug.locale = (Thread.current[:globalize_locale] || ::I18n.locale) if friendly_id_config.class.locales_used?
|
61
61
|
@new_friendly_id = @slug.to_friendly_id
|
62
62
|
end
|
63
63
|
|
data/lib/friendly_id/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: friendly_id_globalize3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 3.2.1.
|
5
|
+
version: 3.2.1.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Norman Clarke
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2011-04-
|
15
|
+
date: 2011-04-19 00:00:00 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: babosa
|