active_record-acts_as 5.0.3 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +40 -0
- data/.gitignore +1 -0
- data/Appraisals +5 -1
- data/CHANGELOG.md +4 -0
- data/README.md +9 -12
- data/active_record-acts_as.gemspec +2 -1
- data/gemfiles/rails_6.0.gemfile +1 -1
- data/gemfiles/rails_6.1.gemfile +1 -1
- data/gemfiles/rails_7.0.gemfile +8 -0
- data/gemfiles/rails_master.gemfile +1 -1
- data/lib/active_record/acts_as/version.rb +1 -1
- data/spec/spec_helper.rb +5 -0
- metadata +23 -8
- data/.travis.yml +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 532e3effe05da886dea3162ea29263ecce12c459e321bcd4fb870554a0227053
|
4
|
+
data.tar.gz: 0e0a4d871dd0bd2be5e2521ddd36abbe9d8038b1bc3c046401abf6ac1c727bbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0477314dde10d98e065be763b4555c3f9915909f129be5b53e5385d41c739dc3482ad4ee4ddc504b60d1e69fd57f36326a995d7cc3d3ab9a86a9a7b4d32ecb25
|
7
|
+
data.tar.gz: 3607a37917ee5fcd6eca4f0a3df7f14a55252e4777faeadb736bb76312bfe0c2dd372779ccf353d8f883472d41504917ce6c1d95deaf20998763db28fe41f1a8
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: Ruby
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ "master" ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ "master" ]
|
15
|
+
|
16
|
+
permissions:
|
17
|
+
contents: read
|
18
|
+
|
19
|
+
jobs:
|
20
|
+
test:
|
21
|
+
|
22
|
+
runs-on: ubuntu-latest
|
23
|
+
strategy:
|
24
|
+
matrix:
|
25
|
+
ruby-version: ['2.7', '3.0', '3.1']
|
26
|
+
activerecord: ['6.0', '6.1', '7.0', 'master']
|
27
|
+
env:
|
28
|
+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/rails_${{ matrix.activerecord }}.gemfile
|
29
|
+
steps:
|
30
|
+
- uses: actions/checkout@v3
|
31
|
+
- name: Set up Ruby
|
32
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
33
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
34
|
+
# uses: ruby/setup-ruby@v1
|
35
|
+
uses: ruby/setup-ruby@0a29871fe2b0200a17a4497bae54fe5df0d973aa # v1.115.3
|
36
|
+
with:
|
37
|
+
ruby-version: ${{ matrix.ruby-version }}
|
38
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
39
|
+
- name: Run tests
|
40
|
+
run: bundle exec rake
|
data/.gitignore
CHANGED
data/Appraisals
CHANGED
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
6
6
|
|
7
7
|
## [Unreleased] -
|
8
|
+
## [5.1.0] - 2023-06-29
|
9
|
+
- Use Github actions instead of travis.yml
|
10
|
+
- Add support for ruby 2.7 3.0 and 3.1
|
11
|
+
- Add support for rails 7
|
8
12
|
|
9
13
|
## [5.0.2] - 2021-07-27
|
10
14
|
|
data/README.md
CHANGED
@@ -1,9 +1,6 @@
|
|
1
|
-
[](http://badge.fury.io/rb/active_record-acts_as)
|
2
|
-
[](https://travis-ci.org/chaadow/active_record-acts_as)
|
3
|
-
|
4
1
|
# ActiveRecord::ActsAs
|
5
|
-
|
6
|
-
|
2
|
+

|
3
|
+

|
7
4
|
|
8
5
|
Simulates multiple-table-inheritance (MTI) for ActiveRecord models.
|
9
6
|
By default, ActiveRecord only supports single-table inheritance (STI).
|
@@ -21,8 +18,6 @@ a separate table for each product type, i.e. a `pens` table with `color` column.
|
|
21
18
|
* Ruby >= `2.5`
|
22
19
|
* ActiveSupport >= `6.0`
|
23
20
|
* ActiveRecord >= `6.0`
|
24
|
-
* Regarding ActiveRecord `5.2.x` please use version `4.0.3` of this gem. If you encounter any bug you can open an issue.
|
25
|
-
Maintenance will be stopped after the release of ActiveRecord `6.2`
|
26
21
|
|
27
22
|
## Installation
|
28
23
|
|
@@ -129,6 +124,12 @@ Pen.first.acting_as
|
|
129
124
|
# => #<Product ...>
|
130
125
|
```
|
131
126
|
|
127
|
+
Likewise, `actables` converts a relation of specific objects to their parent objects:
|
128
|
+
```ruby
|
129
|
+
Pen.where(...).actables
|
130
|
+
# => [#<Product ...>, ...]
|
131
|
+
```
|
132
|
+
|
132
133
|
In `has_many` case you can use subclasses:
|
133
134
|
|
134
135
|
```Ruby
|
@@ -174,7 +175,7 @@ Make sure you know what you are doing when overwriting `polymorphic` option.
|
|
174
175
|
|
175
176
|
If your `actable` and `acts_as` models are namespaced, you need to configure them like this:
|
176
177
|
|
177
|
-
```
|
178
|
+
```Ruby
|
178
179
|
class MyApp::Product < ApplicationRecord
|
179
180
|
actable inverse_of: :product
|
180
181
|
end
|
@@ -187,14 +188,10 @@ end
|
|
187
188
|
## Caveats
|
188
189
|
|
189
190
|
Multiple `acts_as` in the same class are not supported!
|
190
|
-
|
191
|
-
|
192
191
|
## Migrating from acts_as_relation
|
193
192
|
|
194
193
|
Replace `acts_as_superclass` in models with `actable` and if you where using
|
195
194
|
`:as_relation_superclass` option on `create_table` remove it and use `t.actable` on column definitions.
|
196
|
-
|
197
|
-
|
198
195
|
## RSpec custom matchers
|
199
196
|
|
200
197
|
To use this library custom RSpec matchers, you must require the `rspec/acts_as_matchers` file.
|
@@ -24,7 +24,8 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "sqlite3"
|
25
25
|
spec.add_development_dependency "bundler"
|
26
26
|
spec.add_development_dependency "rspec", "~> 3"
|
27
|
-
spec.add_development_dependency "
|
27
|
+
spec.add_development_dependency "psych", "3.3.2"
|
28
|
+
spec.add_development_dependency "rake"
|
28
29
|
spec.add_development_dependency "appraisal", "~> 2.1"
|
29
30
|
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
30
31
|
|
data/gemfiles/rails_6.0.gemfile
CHANGED
data/gemfiles/rails_6.1.gemfile
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -11,3 +11,8 @@ require 'active_record'
|
|
11
11
|
if ActiveRecord::Base.respond_to?(:raise_in_transactional_callbacks=)
|
12
12
|
ActiveRecord::Base.raise_in_transactional_callbacks = true
|
13
13
|
end
|
14
|
+
if ActiveRecord.version > Gem::Version.new('6.2')
|
15
|
+
ActiveRecord.use_yaml_unsafe_load = true
|
16
|
+
else
|
17
|
+
ActiveRecord::Base.use_yaml_unsafe_load = true
|
18
|
+
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: 5.0
|
4
|
+
version: 5.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hassan Zamani
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2023-06-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: sqlite3
|
@@ -54,20 +54,34 @@ dependencies:
|
|
54
54
|
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '3'
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: psych
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - '='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 3.3.2
|
64
|
+
type: :development
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - '='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 3.3.2
|
57
71
|
- !ruby/object:Gem::Dependency
|
58
72
|
name: rake
|
59
73
|
requirement: !ruby/object:Gem::Requirement
|
60
74
|
requirements:
|
61
|
-
- - "
|
75
|
+
- - ">="
|
62
76
|
- !ruby/object:Gem::Version
|
63
|
-
version: '
|
77
|
+
version: '0'
|
64
78
|
type: :development
|
65
79
|
prerelease: false
|
66
80
|
version_requirements: !ruby/object:Gem::Requirement
|
67
81
|
requirements:
|
68
|
-
- - "
|
82
|
+
- - ">="
|
69
83
|
- !ruby/object:Gem::Version
|
70
|
-
version: '
|
84
|
+
version: '0'
|
71
85
|
- !ruby/object:Gem::Dependency
|
72
86
|
name: appraisal
|
73
87
|
requirement: !ruby/object:Gem::Requirement
|
@@ -149,9 +163,9 @@ executables:
|
|
149
163
|
extensions: []
|
150
164
|
extra_rdoc_files: []
|
151
165
|
files:
|
166
|
+
- ".github/workflows/ruby.yml"
|
152
167
|
- ".gitignore"
|
153
168
|
- ".rspec"
|
154
|
-
- ".travis.yml"
|
155
169
|
- Appraisals
|
156
170
|
- CHANGELOG.md
|
157
171
|
- Gemfile
|
@@ -164,6 +178,7 @@ files:
|
|
164
178
|
- bin/console
|
165
179
|
- gemfiles/rails_6.0.gemfile
|
166
180
|
- gemfiles/rails_6.1.gemfile
|
181
|
+
- gemfiles/rails_7.0.gemfile
|
167
182
|
- gemfiles/rails_master.gemfile
|
168
183
|
- lib/active_record/acts_as.rb
|
169
184
|
- lib/active_record/acts_as/class_methods.rb
|
@@ -202,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
202
217
|
- !ruby/object:Gem::Version
|
203
218
|
version: '0'
|
204
219
|
requirements: []
|
205
|
-
rubygems_version: 3.
|
220
|
+
rubygems_version: 3.1.6
|
206
221
|
signing_key:
|
207
222
|
specification_version: 4
|
208
223
|
summary: Simulate multi-table inheritance for activerecord models
|
data/.travis.yml
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
sudo: false
|
3
|
-
rvm:
|
4
|
-
- 2.6
|
5
|
-
- 2.7
|
6
|
-
- 3.0
|
7
|
-
before_install:
|
8
|
-
- gem update --system
|
9
|
-
gemfile:
|
10
|
-
- gemfiles/rails_6.0.gemfile
|
11
|
-
- gemfiles/rails_6.1.gemfile
|
12
|
-
- gemfiles/rails_master.gemfile
|
13
|
-
jobs:
|
14
|
-
exclude:
|
15
|
-
- rvm: 2.6
|
16
|
-
gemfile: gemfiles/rails_master.gemfile
|