Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise if using an unsupported Rails version #485

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/dotenv/rails.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Since rubygems doesn't support optional dependencies, we have to manually check
unless Gem::Requirement.new(">= 6.1").satisfied_by?(Gem::Version.new(Rails.version))
warn "dotenv 3.0 only supports Rails 6.1 or later. Use dotenv ~> 2.0."
return
begin
gem "railties", ">= 6.1"
rescue LoadError => error
warn "dotenv 3.0 only supports Rails 6.1 or later. Use dotenv ~> 2.0 in your Gemfile: `gem 'dotenv', '~> 2.0'."
raise error
end

require "dotenv"
Expand Down