temping 3.5.0 → 3.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/temping.rb +9 -1
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f92d92121487913bed32cd4671b17b4a0994e084
4
- data.tar.gz: ef135c7c09c1c0a00392558cd6ba7af2eb60ac53
3
+ metadata.gz: 3c776b555a0619329b67d0b0f2f9ab69b3da9c2a
4
+ data.tar.gz: 4131bbfd5438cba4e5be09aead3b6b0a5433d807
5
5
  SHA512:
6
- metadata.gz: b92be9a6ec904abdb56adc5fd1f1060ee31f680ccd3d2c65152510c2631b16f5c1570722e163bd160a953a325a0d830a75eea36c2058d9d055a52341bd74b80b
7
- data.tar.gz: 93f375e21e966c47e831448ecc4077975713cb09fa60f9aea9c5d40d591ed3e6ea76e05e020fc0439b9fab174a02a75af0d88166631f5c6cf4758775219097bc
6
+ metadata.gz: 794a60b86450c0a221654efb828aff3277be52d0db8038f8c37cd6aa4da1cf51dac57e890858d732743d9e1223e4ec804c8259037424cbde741e338d318b93b5
7
+ data.tar.gz: 86c94528287fec51235f6557dc59c209cd8a5ea0393f7cdaa21e116764dc164078fb5de089552c967f3a425d476057e505d14b7ff6e5b94276bda4e292e48c10
@@ -44,7 +44,7 @@ class Temping
44
44
  private
45
45
 
46
46
  def build
47
- Class.new(ActiveRecord::Base).tap do |klass|
47
+ Class.new(model_parent_class).tap do |klass|
48
48
  Object.const_set(@model_name, klass)
49
49
 
50
50
  klass.primary_key = :id
@@ -53,6 +53,14 @@ class Temping
53
53
  end
54
54
  end
55
55
 
56
+ def model_parent_class
57
+ if ActiveRecord::VERSION::MAJOR > 4 && defined?(ApplicationRecord)
58
+ ApplicationRecord
59
+ else
60
+ ActiveRecord::Base
61
+ end
62
+ end
63
+
56
64
  DEFAULT_OPTIONS = { :temporary => true }
57
65
  def create_table(options = {})
58
66
  connection.create_table(table_name, DEFAULT_OPTIONS.merge(options))
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: temping
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.0
4
+ version: 3.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Pignata
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-28 00:00:00.000000000 Z
11
+ date: 2016-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord