simonmenke-globalize2 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,6 +24,8 @@ module Globalize
24
24
  include InstanceMethods
25
25
  extend ClassMethods
26
26
 
27
+ metaclass.alias_method_chain :find_every, :globalize2
28
+
27
29
  self.globalize_proxy = Globalize::Model::ActiveRecord.create_proxy_class(self)
28
30
  has_many(
29
31
  :globalize_translations,
@@ -106,6 +108,16 @@ module Globalize
106
108
  self.connection.drop_table translation_table_name
107
109
  end
108
110
 
111
+ def find_every_with_globalize2(options)
112
+ locale = I18n.locale
113
+ locales = I18n.fallbacks[locale].map{ |tag| tag.to_s }
114
+ scope_options = { :joins => :globalize_translations,
115
+ :conditions => [ "#{i18n_attr('locale')} IN (?)", locales ] }
116
+ with_scope(:find => scope_options) do
117
+ find_every_without_globalize2(options)
118
+ end
119
+ end
120
+
109
121
  private
110
122
 
111
123
  def i18n_attr(attribute_name)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simonmenke-globalize2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Harvey
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-28 00:00:00 -07:00
12
+ date: 2009-06-15 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15