In Apatana Rad Rails, I want to run the rails console in debug mode. When I launch the debugger as shown below, debugger doesn't honor the break points.
debug script/console
I am able to run the rake tasks in debug mode by giving a similar command, i.e.
debug rake db:migrate
Any pointers will be highly appreciated.
Seems like you're running RadRails 2. You might be able to get it to work correctly by right-clicking the script/console file and choosing Debug As > Ruby Application. The "Rails console" had some special hacks and contortions to handle commands like "debug rake ...", but under the hood it's doing the same as the Debug As action above and then tying the input/output to the console view.
Related
In development mode, eager_loading is disabled
Sometimes, syntax error occur, and having eager_loading set to false does not help to identify those. Is there a rails command (rake tasks) that could trigger such check ?
The point here is not to run test to find out, but to setup/use a command that would provide a similar result as a rails startup in production
In case your app is not 100% test covered and some classes / setup might break in case eager_login is enabled (eg. production mode)
You can emulate such verification with the following (useful for pipelines before tests for example):
RAILS_ENV=production SECRET_KEY_BASE=xyz rails runner "some rails console command"
I wanted to debug a test (MiniTest) in my Rails app. Therefore I followed the instruction on the Minitest-Debugger Github Page. Here is the important snippet:
Add this to the top of your test file or helper:
require 'minitest/debugger' if ENV['DEBUG']
Then run your tests as normal but define DEBUG=1:
% DEBUG=1 rake test
Debug.rb
Emacs support available.
Since then, all rails commands (like rails server or bundle exec rake test) I type into the console from my app directory try to start the debugger, which doesn't even work right but gives me some error messages from classes / parts outside my app.
% rails s
Debug.rb
Emacs support available.
/Users/chris/.rvm/gems/ruby-2.0.0-p353/gems/binding_of_caller-0.7.2/lib/binding_of_caller/mri2.rb:25: `' (NilClass)
How can I reset my environment / Rails / Ruby so it runs normally. I tried of course:
% DEBUG=0 rails s
But that didn't change anything. I deleted everything I set up in order to debug.
What do I have to do to stop Rails from entering debug-mode?
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)
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".
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
is there a way to debug all/single tests in Aptana Studio / Eclipse?
ruby-debug19 & ruby-debug-ide are installed and I'm able to set breakpoints and debug my development environment, e.g. in a controller's index method. If I go to http://localhost:3000/controler_name eclipse opens debugging perspective and halts.
But how to do that with tests / rspec tests?
Thanks in advance.
For a normal ruby file, right click on it and select Debug As > Ruby application.
If your test is a rails one that requires some setup, or you want to debug the whole suite, you'll need to generate a debug configuration manually (or edit one manually).
Run > Debug As > Debug configurations... Then add an entry under Ruby application. Point it at your rake script path (say /usr/local/bin/rake) as the file to launch and then edit the arguments to pass in your app's Rakefile as the first arg and the rake task as the second arg. (i.e. /my/path/to/project/Rakefile tests)
Netbeans ide has rails console? I use Netbeans for PHP for a long time, and now I want use to my Rails applications. I saw the generators, bundle has a fast gui menu, but can I use this commands myself in Netbeans, so I looking a built in console.
right-click on the project in ur Project window, u will see a selection called "Rails Console"
-edit-
if you want shell, terminal. you might have to launch it will cmd, ssh or whatever way to access it.
--edit 2--
you might can check this out:
http://wiki.netbeans.org/FaqRubyTerminalEmulator