active_record-acts_as 2.4.2 → 2.5.0

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: d36aaa8f22e66b7d9fd5c2280f4548e9efe3b3fe
4
- data.tar.gz: 9f30018fa7aaaffc40c8c915b0ed6cc7cd8abda3
3
+ metadata.gz: 381abee602366b8d970bc208a1819ff1fdcabeca
4
+ data.tar.gz: 2d91f0310bc581b9f73082de2f4984c31a0f0345
5
5
  SHA512:
6
- metadata.gz: 7b9a24160409f92c1bc8e1e81e85dcd2553c133804507bf1eb848aff3865a65a9bb173a0cc6f237d7877998761acd7d89fa838ff7484486e4a50ba188429d1e0
7
- data.tar.gz: 672a6b0320fdaa101567546b887a652a993a61d1ccb0d130d3eb55c332c68b09750d2cceb5990aac57cfbc03fee4536c6d3c20b68f03dbdcac614b1ca56c014d
6
+ metadata.gz: 613c0f9a5f14344ca1d69f82ad007b18d12d0089a513eebee7119aeef2e317b05d07e569dd5c31de8e8b1cf5786f69e5ec4e085364355ae9d8438b8dfc6d5755
7
+ data.tar.gz: 6f4b3bdbda336c4109150a87bb640f2e5e5e7dbe79963a0713c18a08a1cca8aaf564576c05e474ca9d6478d893d71bbcbaf52c6f1cda3c8c00558ad25eb53117
@@ -10,3 +10,6 @@ before_install:
10
10
  gemfile:
11
11
  - gemfiles/rails_4.2.gemfile
12
12
  - gemfiles/rails_5.0.gemfile
13
+ - gemfiles/rails_5.1.gemfile
14
+ allow_failures:
15
+ - gemfile: gemfiles/rails_5.1.gemfile
data/Appraisals CHANGED
@@ -5,3 +5,7 @@ end
5
5
  appraise 'rails-5.0' do
6
6
  gem 'rails', '~> 5.0.0'
7
7
  end
8
+
9
+ appraise 'rails-5.1' do
10
+ gem 'rails', '~> 5.1.0'
11
+ end
data/README.md CHANGED
@@ -171,6 +171,19 @@ acts_as :person, -> { includes(:friends) }
171
171
 
172
172
  Make sure you know what you are doing when overwriting `polymorphic` option.
173
173
 
174
+ ### Namespaced models
175
+
176
+ If your `actable` and `acts_as` models are namespaced, you need to configure them like this:
177
+
178
+ ```
179
+ class MyApp::Product < ApplicationRecord
180
+ actable inverse_of: :pen
181
+ end
182
+
183
+ class MyApp::Pen < ApplicationRecord
184
+ acts_as :product, class_name: 'MyApp::Product'
185
+ end
186
+ ```
174
187
 
175
188
  ## Caveats
176
189
 
@@ -27,6 +27,6 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency "appraisal", "~> 2.1"
28
28
  spec.add_development_dependency "guard-rspec", "~> 4.7"
29
29
 
30
- spec.add_dependency "activesupport", ">= 4.2"
31
- spec.add_dependency "activerecord", ">= 4.2"
30
+ spec.add_dependency "activesupport", ">= 4.2", "<= 5.0"
31
+ spec.add_dependency "activerecord", ">= 4.2", "<= 5.0"
32
32
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "coveralls", :require => false
5
+ gem "coveralls", require: false
6
6
  gem "rails", "~> 4.2.0"
7
7
 
8
- gemspec :path => "../"
8
+ gemspec path: "../"
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "coveralls", :require => false
5
+ gem "coveralls", require: false
6
6
  gem "rails", "~> 5.0.0"
7
7
 
8
- gemspec :path => "../"
8
+ gemspec path: "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "coveralls", require: false
6
+ gem "rails", "~> 5.1.0"
7
+
8
+ gemspec path: "../"
@@ -42,7 +42,7 @@ module ActiveRecord
42
42
  if attribute_method?(store_attribute.to_s)
43
43
  super
44
44
  else
45
- acting_as.read_store_attribute(store_attribute, key)
45
+ acting_as.send(:read_store_attribute, store_attribute, key)
46
46
  end
47
47
  end
48
48
 
@@ -28,11 +28,11 @@ module ActiveRecord
28
28
  validate :actable_must_be_valid if validates_actable
29
29
 
30
30
  unless touch == false
31
- after_update :touch, if: :changed?
31
+ after_update :touch, if: ActiveRecord.version.to_s.to_f >= 5.1 ? :saved_changes? : :changed?
32
32
  end
33
33
 
34
34
  before_save do
35
- @_acting_as_changed = acting_as.changed?
35
+ @_acting_as_changed = ActiveRecord.version.to_s.to_f >= 5.1 ? acting_as.saved_changes? : acting_as.changed?
36
36
  true
37
37
  end
38
38
  after_commit do
@@ -1,6 +1,6 @@
1
1
  module ActiveRecord
2
2
  module ActsAs
3
- VERSION = "2.4.2"
3
+ VERSION = "2.5.0"
4
4
  end
5
5
  end
6
6
 
@@ -1,22 +1,23 @@
1
1
  require 'database_helper'
2
2
  require 'active_record/acts_as'
3
3
 
4
-
5
4
  class Product < ActiveRecord::Base
6
5
  end
7
6
 
8
- class RemoveActableFromProducts < ActiveRecord::Migration
7
+ migration_class = ActiveRecord::Migration.respond_to?(:[]) ? ActiveRecord::Migration[4.2] : ActiveRecord::Migration
8
+
9
+ class RemoveActableFromProducts < migration_class
9
10
  def change
10
- change_table(:products) do |t|
11
+ change_table :products do |t|
11
12
  t.remove_actable
12
13
  end
13
14
  end
14
15
  end
15
16
 
16
- class RemoveProduceableFromProducts < ActiveRecord::Migration
17
+ class RemoveProduceableFromProducts < migration_class
17
18
  def change
18
- change_table(:products) do |t|
19
- t.remove_actable(as: :produceable)
19
+ change_table :products do |t|
20
+ t.remove_actable as: :produceable
20
21
  end
21
22
  end
22
23
  end
@@ -6,3 +6,8 @@ RSpec.configure do |config|
6
6
  config.filter_run_including focus: true
7
7
  config.run_all_when_everything_filtered = true
8
8
  end
9
+
10
+ require 'active_record'
11
+ if ActiveRecord::Base.respond_to?(:raise_in_transactional_callbacks=)
12
+ ActiveRecord::Base.raise_in_transactional_callbacks = true
13
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record-acts_as
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.2
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hassan Zamani
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-04-20 00:00:00.000000000 Z
12
+ date: 2017-07-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sqlite3
@@ -102,6 +102,9 @@ dependencies:
102
102
  - - ">="
103
103
  - !ruby/object:Gem::Version
104
104
  version: '4.2'
105
+ - - "<="
106
+ - !ruby/object:Gem::Version
107
+ version: '5.0'
105
108
  type: :runtime
106
109
  prerelease: false
107
110
  version_requirements: !ruby/object:Gem::Requirement
@@ -109,6 +112,9 @@ dependencies:
109
112
  - - ">="
110
113
  - !ruby/object:Gem::Version
111
114
  version: '4.2'
115
+ - - "<="
116
+ - !ruby/object:Gem::Version
117
+ version: '5.0'
112
118
  - !ruby/object:Gem::Dependency
113
119
  name: activerecord
114
120
  requirement: !ruby/object:Gem::Requirement
@@ -116,6 +122,9 @@ dependencies:
116
122
  - - ">="
117
123
  - !ruby/object:Gem::Version
118
124
  version: '4.2'
125
+ - - "<="
126
+ - !ruby/object:Gem::Version
127
+ version: '5.0'
119
128
  type: :runtime
120
129
  prerelease: false
121
130
  version_requirements: !ruby/object:Gem::Requirement
@@ -123,6 +132,9 @@ dependencies:
123
132
  - - ">="
124
133
  - !ruby/object:Gem::Version
125
134
  version: '4.2'
135
+ - - "<="
136
+ - !ruby/object:Gem::Version
137
+ version: '5.0'
126
138
  description: Simulate multi-table inheritance for activerecord models using a plymorphic
127
139
  association
128
140
  email:
@@ -148,6 +160,7 @@ files:
148
160
  - bin/console
149
161
  - gemfiles/rails_4.2.gemfile
150
162
  - gemfiles/rails_5.0.gemfile
163
+ - gemfiles/rails_5.1.gemfile
151
164
  - lib/active_record/acts_as.rb
152
165
  - lib/active_record/acts_as/class_methods.rb
153
166
  - lib/active_record/acts_as/instance_methods.rb
@@ -184,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
197
  version: '0'
185
198
  requirements: []
186
199
  rubyforge_project:
187
- rubygems_version: 2.6.11
200
+ rubygems_version: 2.6.12
188
201
  signing_key:
189
202
  specification_version: 4
190
203
  summary: Simulate multi-table inheritance for activerecord models