foreigner 1.7.2 → 1.7.3

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: 9659be7bd66b453f51a66ce111a04948edd03019
4
- data.tar.gz: 1690901601fc8957e2bf57bad7c9ea7403c82733
3
+ metadata.gz: 06dda6720913150207e47f83ac7b0cd2596a7b03
4
+ data.tar.gz: 0fc6f018adc7a26c4209075eab475107e4d244b6
5
5
  SHA512:
6
- metadata.gz: ffd1cd048c62f8711d3f552f1bab29a9b8fe9585160804f5a8de4b3cb032f3cc45a30d05451ab8b1156ec65fee0dc58f7e1feb831999e7591c0c3dab75e6ca9f
7
- data.tar.gz: 41230bd111817bcb7ac80b20377c8945f7975fdc4e54a9757f1de2a0cc38b19b9d9002461600bd18aa5e9cc8a0c98951e5008aa2e83f9693524c7ed783233f9a
6
+ metadata.gz: c396e9fc220a759ce00c400f7ef7b0e0f2a85bd254eb6fb554156f3f82d5700274d1bff408ffde47ffaebf813d144fa058d86751d2c186245aa948d3271305b4
7
+ data.tar.gz: 5f420b8ca90be4d2f3ba21b265e4c544ded45b749d767a1f5cd66dc715efe65f3f32cfabc00e861490f45c306894e4ec3c945dc5e2a571a9aa90460347535105
@@ -2,9 +2,9 @@ module Foreigner
2
2
  module Helper
3
3
  def self.active_record_version
4
4
  if ::ActiveRecord.respond_to? :version
5
- ActiveRecord.version.to_s
5
+ ActiveRecord.version
6
6
  elsif ::ActiveRecord::VERSION
7
- ::ActiveRecord::VERSION
7
+ Gem::Version.new(::ActiveRecord::VERSION)
8
8
  else
9
9
  raise "Unknown ActiveRecord Version API"
10
10
  end
@@ -40,12 +40,17 @@ module Foreigner
40
40
  module_function :remove_prefix_and_suffix
41
41
  end
42
42
 
43
+ def requires_foreigner_load?
44
+ major, minor, patch = Foreigner::Helper.active_record_version.segments
45
+ major == 4 && minor == 1 && patch >= 9
46
+ end
47
+
43
48
  def tables_with_foreign_keys(stream)
44
49
  tables_without_foreign_keys(stream)
45
50
  # Ensure Foreigner to be initialized before running foreign_keys.
46
51
  # This is required since schema::load is not initializing the environment
47
52
  # anymore in Rails 4.1.9 (https://github.com/rails/rails/commit/5d6bb89f)
48
- stream.puts ' Foreigner.load' if Foreigner::Helper.active_record_version == '4.1.9'
53
+ stream.puts ' Foreigner.load' if requires_foreigner_load?
49
54
  @connection.tables.sort.each do |table|
50
55
  next if ['schema_migrations', ignore_tables].flatten.any? do |ignored|
51
56
  case ignored
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreigner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.2
4
+ version: 1.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Higgins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-10 00:00:00.000000000 Z
11
+ date: 2015-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  version: 1.3.5
109
109
  requirements: []
110
110
  rubyforge_project: foreigner
111
- rubygems_version: 2.2.2
111
+ rubygems_version: 2.4.5
112
112
  signing_key:
113
113
  specification_version: 4
114
114
  summary: Foreign Keys for Rails