Skip to content

Commit

Permalink
Merge pull request #3032 from AlchemyCMS/rails-8
Browse files Browse the repository at this point in the history
Allow Rails 8.0
  • Loading branch information
tvdeyen authored Jan 6, 2025
2 parents 17416ee + 6a99e6a commit 53b369c
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 9 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ jobs:
- "7.0"
- "7.1"
- "7.2"
- "8.0"
ruby:
- "3.1"
- "3.2"
Expand All @@ -75,6 +76,16 @@ jobs:
- sqlite
- postgresql
- mariadb
exclude:
- rails: "8.0"
ruby: "3.1"
database: sqlite
- rails: "8.0"
ruby: "3.1"
database: postgresql
- rails: "8.0"
ruby: "3.1"
database: mariadb
env:
DB: ${{ matrix.database }}
DB_USER: alchemy_user
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1"
ruby-version: "3.2"
bundler-cache: true
rubygems: "latest"
- name: Lint Ruby files
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ source "https://rubygems.org"

gemspec

rails_version = ENV.fetch("RAILS_VERSION", "7.2")
rails_version = ENV.fetch("RAILS_VERSION", "8.0")
gem "rails", "~> #{rails_version}.0"

if ENV["DB"].nil? || ENV["DB"] == "sqlite"
gem "sqlite3", (rails_version == "7.0") ? "~> 1.7.0" : "~> 2.0.0"
gem "sqlite3", (rails_version == "7.0") ? "~> 1.7" : "~> 2.0"
end
if ENV["DB"] == "mysql" || ENV["DB"] == "mariadb"
gem "mysql2", "~> 0.5.1"
Expand Down
2 changes: 1 addition & 1 deletion alchemy_cms.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Gem::Specification.new do |gem|
activesupport
railties
].each do |rails_gem|
gem.add_runtime_dependency rails_gem, [">= 7.0", "< 7.3"]
gem.add_runtime_dependency rails_gem, [">= 7.0", "< 8.1"]
end

gem.add_runtime_dependency "active_model_serializers", ["~> 0.10.14"]
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
end
end

resource :clipboard, only: :index, controller: "clipboard" do
resource :clipboard, only: [], controller: "clipboard" do
collection do
get :index
delete :clear
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module Dummy
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
if config.respond_to?(:load_defaults)
config.load_defaults ENV["RAILS_VERSION"] || 7.2
config.load_defaults ENV["RAILS_VERSION"] || 8.0
end

# Settings in config/environments/* take precedence over those specified here.
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.2].define(version: 2024_04_11_155901) do
ActiveRecord::Schema[8.0].define(version: 2024_04_11_155901) do
create_table "alchemy_attachments", force: :cascade do |t|
t.string "name"
t.string "file_name"
Expand Down
6 changes: 4 additions & 2 deletions spec/libraries/forms/builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,17 @@
"Template",
controller: controller,
label: "<label>",
text_area: "<textarea>",
textarea: "<textarea>",
text_area: "<textarea>", # need to support Rails 7
content_tag: "<alchemy-tinymce>"
)
end

subject { builder.richtext(attribute) }

it "uses a alchemy-tinymce" do
expect(template).to receive(:text_area).with(
receiving_method = (Rails::VERSION::MAJOR >= 8) ? :textarea : :text_area
expect(template).to receive(receiving_method).with(
"Ding",
:foo,
hash_including(
Expand Down

0 comments on commit 53b369c

Please sign in to comment.