friendly_id_globalize3 3.2.1.1 → 3.2.1.2

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 => (Thread.current[:globalize_locale] || ::I18n.locale)} } if friendly_id_config.class.locales_used?)
9
+ :conditions => (proc{ {:locale => Globalize.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,8 +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
- locale = (Thread.current[:globalize_locale] || ::I18n.locale).to_s
48
- if (locale_slug = slugs.detect{|s| s.locale.to_s == locale}).present?
47
+ if (locale_slug = slugs.detect{|s| s.locale.to_s == Globalize.locale.to_s}).present?
49
48
  locale_slug.to_friendly_id
50
49
  else
51
50
  id.to_s
@@ -58,7 +57,7 @@ module FriendlyId
58
57
  return unless new_slug_needed?
59
58
  @slug = slugs.build :name => slug_text.to_s, :scope => friendly_id_config.scope_for(self),
60
59
  :sluggable => self
61
- @slug.locale = Thread.current[:globalize_locale] || ::I18n.locale if friendly_id_config.class.locales_used?
60
+ @slug.locale = Globalize.locale if friendly_id_config.class.locales_used?
62
61
  @new_friendly_id = @slug.to_friendly_id
63
62
  end
64
63
 
@@ -152,7 +152,11 @@ module FriendlyId
152
152
 
153
153
  # Are localed used by the slugs model?
154
154
  def locales_used?
155
- ::Slug.table_exists? && ::Slug.column_names.include?('locale')
155
+ unless @locales_used.nil?
156
+ @locales_used
157
+ else
158
+ @locales_used = ::Slug.table_exists? && ::Slug.column_names.map(&:to_sym).include?(:locale)
159
+ end
156
160
  end
157
161
  end
158
162
 
@@ -3,7 +3,7 @@ module FriendlyId
3
3
  MAJOR = 3
4
4
  MINOR = 2
5
5
  TINY = 1
6
- BUILD = 1
6
+ BUILD = 2
7
7
  STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
8
8
  end
9
9
  end
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.1
5
+ version: 3.2.1.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Norman Clarke
@@ -12,8 +12,7 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2011-03-26 00:00:00 +13:00
16
- default_executable:
15
+ date: 2011-04-15 00:00:00 Z
17
16
  dependencies:
18
17
  - !ruby/object:Gem::Dependency
19
18
  name: babosa
@@ -129,7 +128,6 @@ files:
129
128
  - extras/template-gem.rb
130
129
  - extras/template-plugin.rb
131
130
  - .gemtest
132
- has_rdoc: true
133
131
  homepage: http://norman.github.com/friendly_id
134
132
  licenses: []
135
133
 
@@ -153,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
151
  requirements: []
154
152
 
155
153
  rubyforge_project: friendly-id
156
- rubygems_version: 1.6.1
154
+ rubygems_version: 1.7.2
157
155
  signing_key:
158
156
  specification_version: 3
159
157
  summary: A comprehensive slugging and pretty-URL plugin. Fork for globalize3 support.