globalize 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c30dff66a561a7f6e3f79ecffe00afea16dd86ff
4
- data.tar.gz: 264b67a3bf456f27ca3ee32e476fe39781402422
3
+ metadata.gz: d231d24dbd88077635e6a9252927db9581754f9a
4
+ data.tar.gz: 33f23cc80e09b4d7a31993c729fb1fa5fc6be140
5
5
  SHA512:
6
- metadata.gz: 1b3670a385e89e159fdac80e336743357a1adea54f124cd023a086970ef0612711b2f7e78a98508ba48b1bea675361934af4726dce868ee582eb2bbac15fd16c
7
- data.tar.gz: 7a3f197f7368577e0824ae58072b388993e90e7867c3e24a4a4abb934838625de3cef78410f584e9b0229c149d485c589b10047f0e2352fbda20813074e5e37e
6
+ metadata.gz: 0fa224e4b6bd57d262c957e48309fd94e46f06cd5b78a9441e4309ba7182b6fff7ed6a98bbae3b41a5662afc18ac6bd727b04827ac94f7a1bc96db39a1b790c9
7
+ data.tar.gz: d5edeb87b6e85ad499bedeec83c4df6174171897ea8916f109a116f10bb0fad86fefa8205a67acd0d5eb205c0a30b9d617b0a64c9635cb0986faa771465c577e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Globalize Changelog
2
2
 
3
+ ## 4.0.1 (2014-3-29)
4
+ * Fix bug where `with_translations` only works if called after `where` in relation chain, fixes [#343](https://github.com/globalize/globalize/issues/343).
5
+ * Use `preload` and `joins` instead of `includes` in `with_translations`, fixes [#329](https://github.com/globalize/globalize/issues/329) (thanks [Andrew Volozhanin](https://github.com/scarfacedeb)).
6
+ * Update `database_cleaner` dependency to 1.2.0.
7
+ * Support use of `first`/`take`/`last` with limit on queries with translated attributes, fixes [#322](https://github.com/globalize/globalize/issues/322) (thanks [prusswan](https://github.com/prusswan)).
8
+ * Ensure that options are always extracted from `attr_names` in `Globalize::ActiveRecord::ActMacro#translates`, PR [#319](https://github.com/globalize/globalize/pull/319) (thanks [Marek](https://github.com/keram)).
9
+
10
+ ## 4.0.0 (2014-1-4)
11
+ * Extract all versioning-related code to separate [globalize-versioning](https://github.com/globalize/globalize-versioning) gem.
12
+
3
13
  ## 4.0.0.alpha.5 (2014-1-4)
4
14
  * Fix issue where globalize breaks has_many through when model called with `where` (thanks [Paul McMahon](https://github.com/pwim)).
5
15
  * Modify dup so that translations are copied, and remove custom clone code to conform to Rails/AR semantics (thanks [Paul McMahon](https://github.com/pwim)).
@@ -41,6 +51,13 @@
41
51
 
42
52
  * Initial release of Rails 4-compatible gem.
43
53
 
54
+ ## 3.1.0 (2014-1-25)
55
+
56
+ * Backport scope support on uniqueness validation from 4.0, drop support for ActiveRecord < 3.1, fixes [#324](https://github.com/globalize/globalize/issues/324).
57
+
58
+ ## 3.0.4 (2014-1-8)
59
+ * Extract all versioning-related code to separate [globalize-versioning](https://github.com/globalize/globalize-versioning) gem.
60
+
44
61
  ## 3.0.3 (2013-12-26)
45
62
 
46
63
  * Ensure that foreign key is always set when saving translations (thanks [Andrew Feng](https://github.com/mingliangfeng)).
data/Gemfile CHANGED
@@ -2,9 +2,6 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- # Per https://github.com/bmabey/database_cleaner/issues/224
6
- gem 'database_cleaner', github: 'bmabey/database_cleaner', branch: 'master'
7
-
8
5
  platforms :rbx do
9
6
  gem 'rubysl', '~> 2.0'
10
7
  end
data/Gemfile.lock CHANGED
@@ -8,9 +8,9 @@ GIT
8
8
  PATH
9
9
  remote: .
10
10
  specs:
11
- globalize (4.0.0.alpha.5)
12
- activemodel (>= 4.0.0)
13
- activerecord (>= 4.0.0)
11
+ globalize (4.0.0)
12
+ activemodel (>= 4.0.0, < 5)
13
+ activerecord (>= 4.0.0, < 5)
14
14
 
15
15
  GEM
16
16
  remote: https://rubygems.org/
@@ -33,8 +33,18 @@ GEM
33
33
  ansi (1.4.3)
34
34
  arel (4.0.1)
35
35
  atomic (1.1.14)
36
+ binding_of_caller (0.7.2)
37
+ debug_inspector (>= 0.0.1)
36
38
  builder (3.1.4)
37
39
  coderay (1.1.0)
40
+ columnize (0.3.6)
41
+ debug_inspector (0.0.2)
42
+ debugger (1.6.3)
43
+ columnize (>= 0.3.1)
44
+ debugger-linecache (~> 1.2.0)
45
+ debugger-ruby_core_source (~> 1.2.4)
46
+ debugger-linecache (1.2.0)
47
+ debugger-ruby_core_source (1.2.4)
38
48
  ffi2-generators (0.1.1)
39
49
  hashie (2.0.5)
40
50
  i18n (0.6.9)
@@ -46,7 +56,9 @@ GEM
46
56
  builder
47
57
  minitest (>= 2.12, < 5.0)
48
58
  powerbar
49
- multi_json (1.8.2)
59
+ multi_json (1.8.4)
60
+ polyamorous (0.6.4)
61
+ activerecord (>= 3.0)
50
62
  powerbar (1.0.11)
51
63
  ansi (~> 1.4.0)
52
64
  hashie (>= 1.1.0)
@@ -54,10 +66,14 @@ GEM
54
66
  coderay (~> 1.0)
55
67
  method_source (~> 0.8)
56
68
  slop (~> 3.4)
57
- pry-nav (0.2.3)
69
+ pry-debugger (0.2.2)
70
+ debugger (~> 1.3)
58
71
  pry (~> 0.9.10)
72
+ pry-stack_explorer (0.4.9.1)
73
+ binding_of_caller (>= 0.7)
74
+ pry (>= 0.9.11)
59
75
  rake (10.1.1)
60
- rdoc (4.1.0)
76
+ rdoc (4.1.1)
61
77
  json (~> 1.4)
62
78
  rubysl (2.0.15)
63
79
  rubysl-abbrev (~> 2.0)
@@ -217,7 +233,7 @@ GEM
217
233
  rubysl-observer (2.0.0)
218
234
  rubysl-open-uri (2.0.0)
219
235
  rubysl-open3 (2.0.0)
220
- rubysl-openssl (2.0.5)
236
+ rubysl-openssl (2.0.6)
221
237
  rubysl-optparse (2.0.1)
222
238
  rubysl-shellwords (~> 2.0)
223
239
  rubysl-ostruct (2.0.4)
@@ -263,6 +279,10 @@ GEM
263
279
  rubysl-zlib (2.0.1)
264
280
  slop (3.4.7)
265
281
  sqlite3 (1.3.8)
282
+ squeel (1.1.1)
283
+ activerecord (>= 3.0)
284
+ activesupport (>= 3.0)
285
+ polyamorous (~> 0.6.0)
266
286
  thread_safe (0.1.3)
267
287
  atomic
268
288
  tzinfo (0.3.38)
@@ -276,8 +296,10 @@ DEPENDENCIES
276
296
  minitest
277
297
  minitest-reporters
278
298
  pry
279
- pry-nav
299
+ pry-debugger
300
+ pry-stack_explorer
280
301
  rake
281
302
  rdoc
282
303
  rubysl (~> 2.0)
283
304
  sqlite3
305
+ squeel
@@ -2,8 +2,9 @@ module Globalize
2
2
  module ActiveRecord
3
3
  module ActMacro
4
4
  def translates(*attr_names)
5
+ options = attr_names.extract_options!
5
6
  # Bypass setup_translates! if the initial bootstrapping is done already.
6
- setup_translates!(attr_names.extract_options!) unless translates?
7
+ setup_translates!(options) unless translates?
7
8
 
8
9
  # Add any extra translatable attributes.
9
10
  attr_names = attr_names.map(&:to_sym)
@@ -9,7 +9,7 @@ module Globalize
9
9
 
10
10
  def with_translations(*locales)
11
11
  locales = translated_locales if locales.empty?
12
- includes(:translations).with_locales(locales).with_required_attributes.references(:translations)
12
+ preload(:translations).joins(:translations).readonly(false).with_locales(locales).with_required_attributes
13
13
  end
14
14
 
15
15
  def with_required_attributes
@@ -2,13 +2,10 @@ module Globalize
2
2
  module ActiveRecord
3
3
  module QueryMethods
4
4
 
5
- attr_accessor :translations_reload_needed
6
-
7
5
  class WhereChain < ::ActiveRecord::QueryMethods::WhereChain
8
6
  def not(opts, *rest)
9
7
  if parsed = @scope.parse_translated_conditions(opts)
10
- @scope.translations_reload_needed = true
11
- @scope.with_translations_in_fallbacks.where.not(parsed, *rest)
8
+ @scope.join_translations.where.not(parsed, *rest)
12
9
  else
13
10
  super
14
11
  end
@@ -19,8 +16,7 @@ module Globalize
19
16
  if opts == :chain
20
17
  WhereChain.new(spawn)
21
18
  elsif parsed = parse_translated_conditions(opts)
22
- self.translations_reload_needed = true
23
- super(parsed, *rest).with_translations_in_fallbacks
19
+ join_translations(super(parsed, *rest))
24
20
  else
25
21
  super
26
22
  end
@@ -34,19 +30,6 @@ module Globalize
34
30
  end
35
31
  end
36
32
 
37
- %w[ first last take ].each do |method_name|
38
- eval <<-END_RUBY
39
- def #{method_name}
40
- super.tap do |f|
41
- if f && translations_reload_needed
42
- f.translations.reload
43
- translations_reload_needed = false
44
- end
45
- end
46
- end
47
- END_RUBY
48
- end
49
-
50
33
  def with_translations_in_fallbacks
51
34
  with_translations(Globalize.fallbacks)
52
35
  end
@@ -72,6 +55,14 @@ module Globalize
72
55
  [name, binds.fetch(name.to_s) { where.right }]
73
56
  }])
74
57
  end
58
+
59
+ def join_translations(relation = self)
60
+ if relation.joins_values.include?(:translations)
61
+ relation
62
+ else
63
+ relation.with_translations_in_fallbacks
64
+ end
65
+ end
75
66
  end
76
67
  end
77
68
  end
@@ -1,3 +1,3 @@
1
1
  module Globalize
2
- Version = '4.0.0'
2
+ Version = '4.0.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: globalize
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven Fuchs
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2014-01-04 00:00:00.000000000 Z
17
+ date: 2014-03-29 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: activerecord
@@ -60,16 +60,16 @@ dependencies:
60
60
  name: database_cleaner
61
61
  requirement: !ruby/object:Gem::Requirement
62
62
  requirements:
63
- - - '>='
63
+ - - ~>
64
64
  - !ruby/object:Gem::Version
65
- version: '0'
65
+ version: 1.2.0
66
66
  type: :development
67
67
  prerelease: false
68
68
  version_requirements: !ruby/object:Gem::Requirement
69
69
  requirements:
70
- - - '>='
70
+ - - ~>
71
71
  - !ruby/object:Gem::Version
72
- version: '0'
72
+ version: 1.2.0
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: minitest
75
75
  requirement: !ruby/object:Gem::Requirement