How To:Debugging Rails 3.1.x app(Ruby 1.9.3) on Ap

2019-06-09 20:52发布

问题:

Is rails debugging supported on Aptana Studio 3. I have earlier debugged Rails applications on Aptana Studio2 with the embedded browser and embedded servers.

1)How to start rails application in Debug Mode?

2)How to enable remote debugging in firefox?

My work environment is as follows and I have been using RVM Rails 3.1.x Ruby 1.9.3 Ubuntu 10.10

I have already installed the debug related gems ruby-debug-base19 (0.11.25) ruby-debug-ide19 (0.4.12)

回答1:

Try removing (commenting out) ruby-debug-base19 from Gemfile. "ruby-debug-ide" should be enough, judging from the comments from a post on different IDE - RubyMine.

For debugging, right click on the project and select "Server Debug", then open the site manually in firefox (you will see the address/port the server listening to in the console). I did not manage to set a breakpoint this way, but I only had a test project with no logic in it, so I am not sure how well it works on a real project.

Not sure about your question on "remote debugging with Firefox".



回答2:

Answer for Q1: Aptana is just an IDE which provides you a not bad interface to input code. I don't think it a very good idea to 'DEBUG' in it.

For me, debugging rails depends on : command line, unit tets and log files. you should first of all, write an failed unit test, then run it in the command line, and write the implementation code, then run unit test, then write implementation code ... sometimes you need to check the output/log file, finally , the unit tests bar turns to green and your code is implemented.

hope this post useful to you: How to configure aptana for instant running of my script

Answer for Q2: I don't know your "remote debugging in firefox". If you want to show detailed error message to someone else, just start your server as "development" mode. e.g.

rails s -p 3000 -e development   

or just:

rails s