Skip to content

Commit

Permalink
Raise if using an unsupported Rails version
Browse files Browse the repository at this point in the history
  • Loading branch information
bkeepers committed Feb 15, 2024
1 parent 09caa4d commit b4e50a5
Showing 1 changed file with 5 additions and 3 deletions.
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

0 comments on commit b4e50a5

Please sign in to comment.