Skip to content

Commit

Permalink
Add the ability to support Rails 6
Browse files Browse the repository at this point in the history
The method parent_name doesn't exist in Rails 6.
Use module_parent_name instead.
  • Loading branch information
vassalloandrea committed Jun 9, 2021
1 parent 2dd4a8f commit 5e17342
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/dev_tools/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ class Railtie < Rails::Railtie
initializer 'dev_tools.initialize' do |app|
Pry.config.should_load_rc = false

Pry.config.prompt_name = "\001\e[1;32m\002#{Rails.application.class.parent_name.downcase}\001\e[0m\002/\001\e[1;31m\002#{Rails.env.downcase}"
parent_name = if Rails::VERSION::MAJOR >= 6
Rails.application.class.module_parent_name
else
Rails.application.class.parent_name
end

Pry.config.prompt_name = "\001\e[1;32m\002#{parent_name.downcase}\001\e[0m\002/\001\e[1;31m\002#{Rails.env.downcase}"

Pry.prompt = [
proc { |target_self, nest_level, pry|
Expand Down

0 comments on commit 5e17342

Please sign in to comment.