mirror of https://github.com/rails/rails
Merge pull request #52616 from byroot/fix-console-app-name
rails console: Handle non standard application names
This commit is contained in:
commit
3dbff874b5
|
@ -135,6 +135,13 @@ module Rails
|
|||
@initialized
|
||||
end
|
||||
|
||||
# Returns the dhasherized application name.
|
||||
#
|
||||
# MyApp::Application.new.name => "my-app"
|
||||
def name
|
||||
self.class.name.underscore.dasherize.delete_suffix("/application")
|
||||
end
|
||||
|
||||
def run_load_hooks! # :nodoc:
|
||||
return self if @ran_load_hooks
|
||||
@ran_load_hooks = true
|
||||
|
|
|
@ -89,9 +89,8 @@ module Rails
|
|||
end
|
||||
|
||||
env = colorized_env
|
||||
app_name = @app.class.module_parent_name.underscore.dasherize
|
||||
prompt_prefix = "%N(#{env})"
|
||||
IRB.conf[:IRB_NAME] = app_name
|
||||
IRB.conf[:IRB_NAME] = @app.name
|
||||
|
||||
IRB.conf[:PROMPT][:RAILS_PROMPT] = {
|
||||
PROMPT_I: "#{prompt_prefix}> ",
|
||||
|
|
Loading…
Reference in New Issue