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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ecd8cd75c441652a7719cc0b040d77a84a95f30b1ea8b19c02aa35fb6bdcd425
4
- data.tar.gz: a94c71a0cc0dec6e7468cc3949260ee521320a15ab09d433a7c6323aa8b2114d
3
+ metadata.gz: 532e3effe05da886dea3162ea29263ecce12c459e321bcd4fb870554a0227053
4
+ data.tar.gz: 0e0a4d871dd0bd2be5e2521ddd36abbe9d8038b1bc3c046401abf6ac1c727bbd
5
5
  SHA512:
6
- metadata.gz: ea6d3e0caa50e3a5e39543684bf372e4d64d5b8adfeb29686523b6674d7d1f4d42449b924f657814cd2c14894068a019d8a8796c45efcc1a76bc1c8cac0ea886
7
- data.tar.gz: 9d12820c023f3c0f9d11594b17c904da1ece86fa4381a791cb84f086cde101078140ab9219dfee08185c7e90143d3ae1cffe7abe4f829e427fce002da72c8366
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
@@ -7,6 +7,7 @@ Gemfile.lock
7
7
  InstalledFiles
8
8
  _yardoc
9
9
  coverage
10
+ /tags
10
11
  doc/
11
12
  lib/bundler/man
12
13
  pkg
data/Appraisals CHANGED
@@ -6,6 +6,10 @@ appraise "rails-6.1" do
6
6
  gem 'rails', '~> 6.1'
7
7
  end
8
8
 
9
+ appraise "rails-7.0" do
10
+ gem 'rails', '~> 7.0'
11
+ end
12
+
9
13
  appraise "rails-master" do
10
- gem 'rails', github: 'rails/rails'
14
+ gem 'rails', github: 'rails/rails', branch: 'main'
11
15
  end
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
- [![Gem Version](https://badge.fury.io/rb/active_record-acts_as.svg)](http://badge.fury.io/rb/active_record-acts_as)
2
- [![Build Status](https://travis-ci.org/chaadow/active_record-acts_as.svg)](https://travis-ci.org/chaadow/active_record-acts_as)
3
-
4
1
  # ActiveRecord::ActsAs
5
-
6
- This is a refactor of [`acts_as_relation`](https://github.com/hzamani/acts_as_relation)
2
+ ![Gem](https://img.shields.io/gem/v/active_record-acts_as?style=for-the-badge)
3
+ ![Build Status](https://img.shields.io/github/actions/workflow/status/chaadow/active_record-acts_as/ruby.yml?style=for-the-badge)
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 "rake", "~> 10"
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
 
@@ -3,6 +3,6 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "coveralls", require: false
6
- gem "rails", "~> 6.0.0"
6
+ gem "rails", "~> 6.0"
7
7
 
8
8
  gemspec path: "../"
@@ -3,6 +3,6 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "coveralls", require: false
6
- gem "rails", "~> 6.1.0"
6
+ gem "rails", "~> 6.1"
7
7
 
8
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", "~> 7.0"
7
+
8
+ gemspec path: "../"
@@ -3,6 +3,6 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "coveralls", require: false
6
- gem "rails", github: 'rails'
6
+ gem "rails", github: "rails/rails", branch: "main"
7
7
 
8
8
  gemspec path: "../"
@@ -1,6 +1,6 @@
1
1
  module ActiveRecord
2
2
  module ActsAs
3
- VERSION = "5.0.3"
3
+ VERSION = "5.1.0"
4
4
  end
5
5
  end
6
6
 
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.3
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: 2021-07-27 00:00:00.000000000 Z
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: '10'
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: '10'
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.2.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