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

Adds support for Rails version >= 7.2 #130

Merged
merged 1 commit into from
Jun 20, 2024
Merged
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
25 changes: 23 additions & 2 deletions lib/pry-rails/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,33 @@ class Railtie < Rails::Railtie
Rails.application.config.console = Pry
end

if (Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR >= 2) ||
Rails::VERSION::MAJOR >= 4
major = Rails::VERSION::MAJOR
minor = Rails::VERSION::MINOR

if (major == 3 && minor >= 2) || (major >= 4 && (major < 7 || (major == 7 && minor < 2)))
require "rails/console/app"
require "rails/console/helpers"
TOPLEVEL_BINDING.eval('self').extend ::Rails::ConsoleMethods
end

if major > 7 || (major == 7 && minor >= 2)
require "rails/commands/console/irb_console"

Module.new do
def reload!
puts "Reloading..."
Rails.application.reloader.reload!
end

::IRB::HelperMethod.helper_methods.each do |name, helper_method_class|
define_method name do |*args, **opts, &block|
helper_method_class.instance.execute(*args, **opts, &block)
end
end

TOPLEVEL_BINDING.eval("self").extend self
end
end
end
end
end