-
Notifications
You must be signed in to change notification settings - Fork 49
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
Exceptions in Rails views are re-raised, losing the original context and making pry-rescue less helpful #89
Comments
I'm not sure if rails sets this up correctly, but you should be able to do Let me know if not. |
Thanks. Alas, cd-cause leaves pry in the same scope. I uploaded a minimal app that illustrates the problem: https://github.com/yar/p-r-test |
I can confirm I have the same issue. Neither web-console is helpful in this case. My code is like this in a view (using simple_form): = f.association :equipment_items,
collection: car_equipment_items_ordered(@car),
as: :grouped_select,
label_method: :name,
value_method: :id,
group_method: :category,
group_label_method: :to_s,
input_html: {data: {equipment_items_url: url_for(controller: 'api/v1/equipment_items', action: 'create')}} And the backtrace looks all right:
But
So I can't |
Not sure if we shouldn't be filing this with Actionview |
As a workaround, in Haml, I add a |
The merged PR #106 solved this problem for me. It just isn't a part of the most recent version of this gem on RubyGems. |
pry-rescue 1.4.2
pry-stack_explorer 0.4.9.2
rails 3.2.21
rspec 3.3.0
rspec-rails 3.3.3
The following occurs in my testing: rails template calls a helper method. The helper method calls a method on my object, and inside it, an exception occurs. The local variables in that object method at the time of the exception are important and I am trying to study them with pry-rescue.
"pry-backtrace" correctly shows my PORO at the very top.
However, "ls" suggests that I am not inside that method, but rather in the scope of the template itself. Local variables of my object are not visible from that context.
I see that Rails tinkers with the original exception, re-raising from a different context, as ActionView::Template::Error.
So this is not really a bug of pry-backtrace, but rather a limitation of its use with Rails. Is there a way to overcome this problem?
The text was updated successfully, but these errors were encountered: