Skip to content

Commit 39cdc27

Browse files
bivanalharcysjonathan
authored andcommitted
chore(version): bump into 4.0.0
- specify exact Rails 6.0 for testing - add rails 7.1 for testing - use yml instead of travis for testing - test supermodel methods being modifiable - test adjustable scoping - test exists? method being correctly defined - add find_or_initialize_by_spec test - include models in migration spec - minor modification in models and spec_helper - added Eraser model for testing - add many entities of Eraser inside the test when doing actables test - safeguard scope to be options in actable
1 parent 784f4f8 commit 39cdc27

15 files changed

+271
-46
lines changed

.github/workflows/ruby.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
schedule:
16+
- cron: '0 0 * * 0'
17+
18+
permissions:
19+
contents: read
20+
21+
jobs:
22+
test:
23+
runs-on: ubuntu-latest
24+
strategy:
25+
matrix:
26+
ruby-version: ['3.0', '3.1', '3.2']
27+
activerecord: ['6.0', '6.1', '7.0', '7.1']
28+
env:
29+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/rails_${{ matrix.activerecord }}.gemfile
30+
steps:
31+
- uses: actions/checkout@v3
32+
- name: Set up Ruby
33+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
34+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
35+
# uses: ruby/setup-ruby@v1
36+
uses: ruby/setup-ruby@v1
37+
with:
38+
ruby-version: ${{ matrix.ruby-version }}
39+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
40+
- name: Run tests
41+
run: bundle exec rake

.travis.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

Appraisals

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
appraise "rails-6.0" do
2-
gem 'rails', '~> 6.0'
2+
gem 'rails', '6.0.6.1'
33
end
44

55
appraise "rails-6.1" do
@@ -9,3 +9,7 @@ end
99
appraise "rails-7.0" do
1010
gem 'rails', '~> 7.0'
1111
end
12+
13+
appraise "rails-7.1" do
14+
gem 'rails', '~> 7.1'
15+
end

CHANGELOG.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,180 @@
11
# Change Log
2+
23
All notable changes to this project will be documented in this file.
34

45
The format is based on [Keep a Changelog](http://keepachangelog.com/)
56
and this project adheres to [Semantic Versioning](http://semver.org/).
67

8+
## [4.0.0] - 2024-06-03
9+
10+
### Added
11+
12+
- Add support for rails 6, 6.1, 7, 7.1 while removing rails 4.x and 5.x
13+
from the travis matrix.
14+
- Add support for ruby 3.0, 3.1, and 3.2
15+
- Update test coverage
16+
- Add `.exists?` support to seamlessly check in both the model and super model
17+
18+
### Fixed
19+
20+
- Bump minimum ruby version to 3.0
21+
- Collection methods such as `<<` work now under rails 6.1
22+
- Prepare for Rails 6.2 breaking change by updating how errors
23+
are accessed and removing warning. They are now ruby objects.
24+
see [this](https://api.rubyonrails.org/v6.1.0/classes/ActiveModel/Errors.html)
25+
- Fixed rails `6.0.x` compatibility for `ActiveRecord::Errors`
26+
- Handle kwargs in ruby 3 in methods delegated to supermodel
27+
- Fix `.actables` to restrict based on type.
28+
29+
### Removed
30+
31+
- Remove last ruby 3 warnings and make the gem **totally compatible with
32+
ruby 3**
33+
- Remove support for rails 4.x and 5.x, as well as ruby 2.x
34+
35+
## [3.0.1] - 2018-04-25
36+
37+
### Changed
38+
39+
- Remove bi-directional autosave and use callbacks
40+
- Ensure that non_cyclic_save does not get called for a new_record
41+
42+
## [3.0.0] - 2019-02-21
43+
44+
## [2.5.0] - 2017-07-29
45+
46+
### Changed
47+
48+
- Drop support for Rails >= 5.0
49+
- Remove warnings occurring in Rails 5.1
50+
751
## [2.4.2] - 2017-04-20
52+
853
### Fixed
54+
955
- Fix querying for conditions with hashes.
1056

1157
## [2.4.1] - 2017-04-19
58+
1259
### Fixed
60+
1361
- Make ActiveRecord::Relation#where! work.
1462

1563
## [2.4.0] - 2017-04-16
64+
1665
### Changed
66+
1767
- Don't make all supermodel class methods callable by submodel, only scopes. Add `callable_by_submodel` to supermodel so users can make their own class methods callable by submodels.
1868

1969
## [2.3.1] - 2017-04-15
70+
2071
### Fixed
72+
2173
- Make calling supermodel class methods work through relations/associations as well
2274

2375
## [2.3.0] - 2017-04-12
76+
2477
### Fixed
78+
2579
- Prevent duplicate validation errors (fixes https://github.com/krautcomputing/active_record-acts_as/issues/2)
2680

2781
### Added
82+
2883
- Added support for touching submodel attributes (https://github.com/krautcomputing/active_record-acts_as/pull/3, thanks to [dezmathio](https://github.com/dezmathio)!)
2984

3085
## [2.2.1] - 2017-04-08
86+
3187
### Fixed
88+
3289
- Make sure submodel instance changes are retained when calling `submodel_instance.acting_as.specific`
3390

3491
## [2.2.0] - 2017-04-08
92+
3593
### Added
94+
3695
- Added support for calling superclass methods on the subclass or subclass relations
3796

3897
## [2.1.1] - 2017-03-22
98+
3999
### Fixed
100+
40101
- Fix querying subclass with `where`, for `enum` (and possibly other) attributes the detection whether the attribute is defined on the superclass or subclass didn't work.
41102

42103
## [2.1.0] - 2017-03-17
104+
43105
### Added
106+
44107
- Access superobjects from query on submodel by calling `.actables`
45108

46109
## [2.0.9] - 2017-03-02
110+
47111
### Fixed
112+
48113
- Fix handling of query conditions that contain a dot
49114

50115
## [2.0.8] - 2017-02-17
116+
51117
### Fixed
118+
52119
- Avoid circular dependency on destroy
53120

54121
## [2.0.7] - 2017-02-17 [YANKED]
122+
55123
### Fixed
124+
56125
- Set reference to submodel when building supermodel
57126

58127
## [2.0.6] - 2017-02-17
128+
59129
### Added
130+
60131
- Allow arguments to #touch and forward them to the supermodel
61132

62133
## [2.0.5] - 2016-12-20
134+
63135
### Fixed
136+
64137
- Don't try to touch supermodel if it's not persisted
65138
- Call `#destroy`, not `#delete`, on the submodule by default to trigger callbacks
66139

67140
## [2.0.4] - 2016-12-07
141+
68142
### Fixed
143+
69144
- Touch associated objects if supermodel is updated
70145

71146
## [2.0.3] - 2016-11-07
147+
72148
### Fixed
149+
73150
- Fix defining associations on `acting_as` model after calling `acting_as`
74151

75152
## [2.0.2] - 2016-11-06
153+
76154
### Fixed
155+
77156
- Call `#touch` on `actable` object when it's called on the `acting_as` object
78157

79158
## [2.0.1] - 2016-10-05
159+
80160
### Added
161+
81162
- Added this changelog
82163
- Added `touch` option to skip touching the `acting_as` object (https://github.com/hzamani/active_record-acts_as/pull/78, thanks to [allenwq](https://github.com/allenwq)!)
83164

84165
## [2.0.0] - 2016-09-14
166+
85167
### Added
168+
86169
- Added support for Rails 5 (https://github.com/hzamani/active_record-acts_as/pull/80, thanks to [nicklandgrebe](https://github.com/nicklandgrebe)!)
87170
- Allow specifying `association_method` parameter (https://github.com/hzamani/active_record-acts_as/pull/72, thanks to [tombowo](https://github.com/tombowo)!)
88171

89172
### Removed
173+
90174
- Dropped support for Ruby < 2.2 and ActiveSupport/ActiveRecord < 4.2
91175

92176
### Fixed
177+
93178
- Fixed `remove_actable` migration helper (https://github.com/hzamani/active_record-acts_as/pull/71, thanks to [nuclearpidgeon](https://github.com/nuclearpidgeon)!)
94179

95180
[Unreleased]: https://github.com/krautcomputing/active_record-acts_as/compare/v2.4.2...HEAD

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
[![Coverage Status](https://coveralls.io/repos/krautcomputing/active_record-acts_as/badge.png)](https://coveralls.io/r/krautcomputing/active_record-acts_as)
55
[![Dependency Status](https://gemnasium.com/krautcomputing/active_record-acts_as.svg)](https://gemnasium.com/krautcomputing/active_record-acts_as)
66

7+
# Change in the Upstream Repo
8+
9+
This branch, initially forked from [the fork of `hzamani`](https://github.com/hzamani/active_record-acts_as), has now been changed into [the fork of `manuelmeurer`](https://github.com/chaadow/active_record-acts_as) since the former repo has mentioned that the currently active development is taking place in the latter one. The latest update for this repo (v4.0.0) follows the version 5.2.0 of `manuelmeurer`'s repo.
10+
711
# ActiveRecord::ActsAs
812

913
This is a refactor of [`acts_as_relation`](https://github.com/hzamani/acts_as_relation)
@@ -21,9 +25,9 @@ a separate table for each product type, i.e. a `pens` table with `color` column.
2125

2226
## Requirements
2327

24-
* Ruby >= 2.2
25-
* ActiveSupport >= 4.2
26-
* ActiveRecord >= 4.2
28+
- Ruby >= 3.0, <= 3.2
29+
- ActiveSupport >= 6.0, <= 7.1
30+
- ActiveRecord >= 6.0, <= 7.1
2731

2832
## Installation
2933

@@ -189,13 +193,11 @@ end
189193

190194
Multiple `acts_as` in the same class are not supported!
191195

192-
193196
## Migrating from acts_as_relation
194197

195198
Replace `acts_as_superclass` in models with `actable` and if you where using
196199
`:as_relation_superclass` option on `create_table` remove it and use `t.actable` on column definitions.
197200

198-
199201
## RSpec custom matchers
200202

201203
To use this library custom RSpec matchers, you must require the `rspec/acts_as_matchers` file.

active_record-acts_as.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
2020

2121
spec.required_ruby_version = ">= 3.0"
2222

23-
spec.add_development_dependency "sqlite3"
23+
spec.add_development_dependency "sqlite3", "~> 1.7"
2424
spec.add_development_dependency "bundler"
2525
spec.add_development_dependency "rspec", "~> 3"
2626
spec.add_development_dependency "psych", "3.3.2"

gemfiles/rails_6.0.gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
source "https://rubygems.org"
44

55
gem "coveralls", require: false
6-
gem "rails", "~> 6.0"
6+
gem "rails", "6.0.6.1"
77

88
gemspec path: "../"

gemfiles/rails_7.1.gemfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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.1"
7+
8+
gemspec path: "../"

lib/active_record/acts_as/relation.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Relation
44
extend ActiveSupport::Concern
55

66
module ClassMethods
7-
def acts_as(name, scope = nil, options = {})
7+
def acts_as(name, scope = nil, **options)
88
options, scope = scope, nil if Hash === scope
99

1010
association_method = options.delete(:association_method)
@@ -84,6 +84,8 @@ def is_a?(klass)
8484
end
8585

8686
def actable(scope = nil, **options)
87+
options, scope = scope, nil if Hash === scope
88+
8789
name = options.delete(:as) || :actable
8890

8991
reflections = belongs_to(name, scope, **options.reverse_merge(validate: false,

lib/active_record/acts_as/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module ActiveRecord
22
module ActsAs
3-
VERSION = "3.0.1"
3+
VERSION = "4.0.0"
44
end
55
end

0 commit comments

Comments
 (0)