"Debugging in rails"

Well ever thought of debugging the rails application , there are many ways , one way which I liked of lately was the debugger in action directly.


Step 1 :  Install ruby-debugger gem “sudo gem install ruby-debugger –include_dependencies”


Step 2 :  Dont forget to start debugging server by saying
ruby script/server  –debugger


Step 3 :  Say debuggger in the action, the console will open in the command line for the code written below to debugger


eg: 
def foo
     debugger
     @object = Active.find(:all) 
end


When in that case in the command line we will get a rbd : opened , where you can debug the object like @object.size etc


Thats it enjoy , there are some other methods like <%= debug @object %> , <%= @object.inspect %> , puts etc which I guess all of us already know abt.

Advertisements
"Debugging in rails"

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s