Skip to content
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

Fix object inspection for cells #394

Open
Startouf opened this issue May 1, 2016 · 1 comment
Open

Fix object inspection for cells #394

Startouf opened this issue May 1, 2016 · 1 comment

Comments

@Startouf
Copy link

Startouf commented May 1, 2016

During the process of debugging, when I want to check under which context I currently am, I usually write something like self in byebug.

It is fine in most cases, but for cells, this command (which I believe calls the inspect method), by default prints every instance variable, and in the case of a cell this is just disastrous (also printing parent_controller variables, etc.)

We're talking about a HUUUGE string here, printed by mistake in the shell. ie,

self.inspect.size # => 2300182 characters

self

# =>
#<EmployeeCell:0x0000001786a120 @parent_controller=#<SearchesController:0x00000017b80aa8
 @_action_has_layout=true, @_routes=nil, @_request=#
<ActionDispatch::Request:0x00000017dcb150 @env={"rack.version"=>[1, 3], "rack.errors"=>#
<IO:<STDERR>>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>false, 
"SCRIPT_NAME"=>"", "QUERY_STRING"=>"utf8=%E2%9C%93&meeting_type=&q=", 
"SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>....

I would love to have something more useful, but even just writing something like

#<EmployeeCell:0x0000001786a120>

Would actually spare me the "WTF" when writing self while debugging a cell context.

I don't know what kind of information we'd want from that inspect, but showing the cell class, the model's inspect, and the @options would make sense ?

@Startouf
Copy link
Author

Same problem for cell context inspection (new feature in cells 4.1).

cell(:song, song, context: { current_user: current_user })

Trying to debug the context of a cell self.contextis very hard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant