Skip to content

Commit 9a8f584

Browse files
committed
Support Rails 8.1
- Expand AR/AS/AM bounds to < 8.3 in gemspec - Normalize cookie SameSite: accept symbols/strings; write symbols to Rails cookie jar; keep strings for test mock - Add Rails 8.1 gemfiles (full and sqlite-only) and 8.2 stubs - Add Rails 8.1 to CI matrix - Update README compatibility and contributing docs - Refactor: use Module#include instead of send(:include) for AR hooks, Sinatra, and TestCase (aligns with upstream PR binarylogic#782) Refs: binarylogic#782
1 parent f2c01d4 commit 9a8f584

File tree

12 files changed

+131
-38
lines changed

12 files changed

+131
-38
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
# `.rubocop.yml`, set `TargetRubyVersion`, to the lowest ruby version
6161
# tested here.
6262
ruby: ["3.1", "3.2", "3.3", "3.4"]
63-
rails: ["7.0", "7.1", "7.2", "8.0"]
63+
rails: ["7.0", "7.1", "7.2", "8.0", "8.1"]
6464
exclude:
6565
# rails 7 requires ruby >= 2.7.0
6666
- rails: "7.0"
@@ -73,6 +73,8 @@ jobs:
7373
ruby: "3.4"
7474
- rails: "8.0"
7575
ruby: "3.1"
76+
- rails: "8.1"
77+
ruby: "3.1"
7678
env:
7779
BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.rb
7880
steps:

CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ BUNDLE_GEMFILE=gemfiles/rails_7.2.rb bundle exec rake
6060
# Rails 8.0
6161
BUNDLE_GEMFILE=gemfiles/rails_8.0.rb bundle install
6262
BUNDLE_GEMFILE=gemfiles/rails_8.0.rb bundle exec rake
63+
64+
# Rails 8.1
65+
BUNDLE_GEMFILE=gemfiles/rails_8.1.rb bundle install
66+
BUNDLE_GEMFILE=gemfiles/rails_8.1.rb bundle exec rake
6367
```
6468

6569
To run a single test:

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -489,17 +489,18 @@ in `authlogic/session/base.rb`.
489489

490490
## 90. Compatibility
491491

492-
| Version | branch | ruby | activerecord |
493-
| ------- | ---------- | -------- | ------------- |
494-
| 6.5.0 | 6-5-stable | >= 2.4.0 | >= 5.2, < 8.0 |
495-
| 6.4.3 | 6-4-stable | >= 2.4.0 | >= 5.2, < 7.1 |
496-
| 5.2 | 5-2-stable | >= 2.3.0 | >= 5.2, < 6.1 |
497-
| 4.5 | 4-5-stable | >= 2.3.0 | >= 4.2, < 5.3 |
498-
| 4.3 | 4-3-stable | >= 2.3.0 | >= 4.2, < 5.3 |
499-
| 4.2 | 4-2-stable | >= 2.2.0 | >= 4.2, < 5.3 |
500-
| 3 | 3-stable | >= 1.9.3 | >= 3.2, < 5.3 |
501-
| 2 | rails2 | >= 1.9.3 | ~> 2.3.0 |
502-
| 1 | ? | ? | ? |
492+
| Version | branch | ruby | activerecord |
493+
| ---------- | ---------- | -------- | -------------- |
494+
| Unreleased | master | >= 2.6.0 | >= 5.2, < 8.3 |
495+
| 6.5.0 | 6-5-stable | >= 2.4.0 | >= 5.2, < 8.0 |
496+
| 6.4.3 | 6-4-stable | >= 2.4.0 | >= 5.2, < 7.1 |
497+
| 5.2 | 5-2-stable | >= 2.3.0 | >= 5.2, < 6.1 |
498+
| 4.5 | 4-5-stable | >= 2.3.0 | >= 4.2, < 5.3 |
499+
| 4.3 | 4-3-stable | >= 2.3.0 | >= 4.2, < 5.3 |
500+
| 4.2 | 4-2-stable | >= 2.2.0 | >= 4.2, < 5.3 |
501+
| 3 | 3-stable | >= 1.9.3 | >= 3.2, < 5.3 |
502+
| 2 | rails2 | >= 1.9.3 | ~> 2.3.0 |
503+
| 1 | ? | ? | ? |
503504

504505
Under SemVer, [changes to dependencies][10] do not require a major release.
505506

authlogic.gemspec

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ require_relative "lib/authlogic/version"
2525
s.required_ruby_version = ">= 2.6.0"
2626

2727
# See doc/rails_support_in_authlogic_5.0.md
28-
s.add_dependency "activemodel", [">= 5.2", "< 8.1"]
29-
s.add_dependency "activerecord", [">= 5.2", "< 8.1"]
30-
s.add_dependency "activesupport", [">= 5.2", "< 8.1"]
28+
# Expand upper bound to support Rails 8.1/8.2 (Active Model/Record/Support 8.1/8.2)
29+
s.add_dependency "activemodel", ">= 5.2", "< 8.3"
30+
s.add_dependency "activerecord", ">= 5.2", "< 8.3"
31+
s.add_dependency "activesupport", ">= 5.2", "< 8.3"
3132
s.add_dependency "request_store", "~> 1.0"
3233
s.add_development_dependency "bcrypt", "~> 3.1"
3334
s.add_development_dependency "byebug", "~> 11.1.3"

gemfiles/rails_8.1.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# frozen_string_literal: true
2+
3+
source "https://rubygems.org"
4+
gemspec path: ".."
5+
6+
gem "activerecord", "~> 8.1.0"
7+
gem "activesupport", "~> 8.1.0"
8+
gem "mysql2", "~> 0.5.6"
9+
gem "pg", "~> 1.5.8"
10+
gem "sqlite3", "~> 2.1.0"

gemfiles/rails_8.1_sqlite.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# frozen_string_literal: true
2+
3+
source "https://rubygems.org"
4+
gemspec path: ".."
5+
6+
gem "activerecord", "~> 8.1.0"
7+
gem "activesupport", "~> 8.1.0"
8+
gem "sqlite3", "~> 2.1.0"

gemfiles/rails_8.2.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# frozen_string_literal: true
2+
3+
source "https://rubygems.org"
4+
gemspec path: ".."
5+
6+
gem "activerecord", "~> 8.2.0"
7+
gem "activesupport", "~> 8.2.0"
8+
gem "mysql2", "~> 0.5.6"
9+
gem "pg", "~> 1.5.8"
10+
gem "sqlite3", "~> 2.1.0"

gemfiles/rails_8.2_sqlite.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# frozen_string_literal: true
2+
3+
source "https://rubygems.org"
4+
gemspec path: ".."
5+
6+
gem "activerecord", "~> 8.2.0"
7+
gem "activesupport", "~> 8.2.0"
8+
gem "sqlite3", "~> 2.1.0"

lib/authlogic/acts_as_authentic/base.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,14 @@ def first_column_to_exist(*columns_to_check)
105105
end
106106

107107
ActiveSupport.on_load :active_record do
108-
ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::Base
109-
ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::Email
110-
ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::LoggedInStatus
111-
ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::Login
112-
ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::MagicColumns
113-
ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::Password
114-
ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::PerishableToken
115-
ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::PersistenceToken
116-
ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::SessionMaintenance
117-
ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::SingleAccessToken
108+
ActiveRecord::Base.include Authlogic::ActsAsAuthentic::Base
109+
ActiveRecord::Base.include Authlogic::ActsAsAuthentic::Email
110+
ActiveRecord::Base.include Authlogic::ActsAsAuthentic::LoggedInStatus
111+
ActiveRecord::Base.include Authlogic::ActsAsAuthentic::Login
112+
ActiveRecord::Base.include Authlogic::ActsAsAuthentic::MagicColumns
113+
ActiveRecord::Base.include Authlogic::ActsAsAuthentic::Password
114+
ActiveRecord::Base.include Authlogic::ActsAsAuthentic::PerishableToken
115+
ActiveRecord::Base.include Authlogic::ActsAsAuthentic::PersistenceToken
116+
ActiveRecord::Base.include Authlogic::ActsAsAuthentic::SessionMaintenance
117+
ActiveRecord::Base.include Authlogic::ActsAsAuthentic::SingleAccessToken
118118
end

lib/authlogic/controller_adapters/sinatra_adapter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@ def self.included(klass)
6464
end
6565
end
6666

67-
Sinatra::Base.send(:include, Authlogic::ControllerAdapters::SinatraAdapter::Adapter::Implementation)
67+
Sinatra::Base.include(Authlogic::ControllerAdapters::SinatraAdapter::Adapter::Implementation)

0 commit comments

Comments
 (0)