Debugging Rails Apps Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

How can you print variable info to the view?

A

< % = debug @variable % >

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the easiest way to display an array or hash, x, in a view?

A

x.inspect

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you add byebug to a project?

A

Add it to the gem file in the development and test groups only.

group :development, :test do
gem ‘byebug’, ‘9.0.6’, platform: :mri
end

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you add a breakpoint in the code with byebug

A

Put the ‘byebug’ command on the line where you want to stop the code. After that you can add breakpoints at the command line.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How can you get a list of the byebug commands?

A

Type ‘help’ in the byebug console

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Whats the difference between step and next in byebug?

A

The next command will take you to the next line of code in the controller, step will take you to the next command to be executed, where ever that it in the program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How can you bring up a web console in a view or controller?

A

In a controller add a line with the following command

console

in a view use the following

< % console % >

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How can you list all the instance variables with web-console?

A

> > instance_variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Where do you add web-console to the gem file?

A

in the development group

group :development do
gem ‘web-console’
end

How well did you know this?
1
Not at all
2
3
4
5
Perfectly