Skip to content

Commit

Permalink
Remove obsolete new_session helper
Browse files Browse the repository at this point in the history
After #44748, the `new_session` helper no longer takes a block and is
the same as calling `app(true)`. Therefore, I think there's no reason to
expose it to Rails console users.
  • Loading branch information
st0012 committed May 6, 2024
1 parent e7d0b04 commit 0de33de
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 18 deletions.
6 changes: 3 additions & 3 deletions railties/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

* Implement Rails console commands and helpers with IRB v1.13's extension APIs

Rails console users will now see `helper`, `controller`, `new_session`, and `app` under
IRB help message's `Helper methods` category. And `reload!` command will be displayed under
the new `Rails console` commands category.
Rails console users will now see `helper`, `controller`, and `app` under IRB help message's
`Helper methods` category. And `reload!` command will be displayed under the new
`Rails console` commands category.

Prior to this change, Rails console's commands and helper methods are added through IRB's
private components and don't show up in its help message, which led to poor discoverability.
Expand Down
9 changes: 0 additions & 9 deletions railties/lib/rails/commands/console/irb_console.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@ def execute
end
end

class NewSession < RailsHelperBase
description "Creates a new ActionDispatch::Integration::Session. If a block is given, the new session will be yielded to it."

def execute
new_session
end
end

class AppInstance < RailsHelperBase
description "Creates a new ActionDispatch::Integration::Session and memoizes it. Use `app(true)` to create a new instance."

Expand All @@ -56,7 +48,6 @@ def execute(*)

IRB::HelperMethod.register(:helper, ControllerHelper)
IRB::HelperMethod.register(:controller, ControllerInstance)
IRB::HelperMethod.register(:new_session, NewSession)
IRB::HelperMethod.register(:app, AppInstance)
IRB::Command.register(:reload!, Reloader)

Expand Down
6 changes: 0 additions & 6 deletions railties/test/application/console_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,6 @@ def test_controller_helper_method
write_prompt "controller.class.name", "ApplicationController"
end

def test_new_session_helper_method
spawn_console("-e development")

write_prompt "new_session.class.name", "ActionDispatch::Integration::Session"
end

def test_app_helper_method
app_file "config/routes.rb", <<-RUBY
Rails.application.routes.draw do
Expand Down

0 comments on commit 0de33de

Please sign in to comment.