Skip to content

Commit ee261ba

Browse files
committed
Use first binding when there is no application binding
If an error happens inside the framework before loading application, the ActionDispatch::ExceptionWrapper shows traces for the framework only. It could be outside of "Rails.root", and so we have to fallback to the first one.
1 parent 32b0658 commit ee261ba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/web_console/session.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def from(storage)
4343
def initialize(bindings)
4444
@id = SecureRandom.hex(16)
4545
@bindings = Array(bindings)
46-
@evaluator = Evaluator.new(initial_binding)
46+
@evaluator = Evaluator.new(application_binding || @bindings.first)
4747

4848
store_into_memory
4949
end
@@ -64,7 +64,7 @@ def switch_binding_to(index)
6464

6565
private
6666

67-
def initial_binding
67+
def application_binding
6868
@bindings.find { |b| b.eval('__FILE__').to_s.start_with?(Rails.root.to_s) }
6969
end
7070

0 commit comments

Comments
 (0)