Is there a way to tell RubyMine to not use webrick?
Recent RubyMine versions allow to specify what web server to use in the Rails Run/Debug configuration:
rails 3, why I can't use command line at ubuntu?
I don't believe your rvm has been setup correctly. For sake of simplicity, let's start from the beginning following the instructions here:
http://beginrescueend.com/rvm/install/
Install in command line.
user$ bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )
Open your .bashrc folder in your home directory.
user$ vim .bashrc
Edit and add:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
Source your .bashrc file and close the terminal
user$ source ~/.bashrc
user$ exit
Reopen terminal and check if rvm is working.
user$ type rvm | head -1
If it returns
rvm is a function
We're good. Check if you have all of the prerequisites:
rvm requirements
Install as necessary. Pick your favorite flavor of ruby (it seems like it is 1.8.7, if so follow the exact command or replace it with your choice).
rvm install 1.8.7
When its done,
rvm use 1.8.7 --default
If this didn't work, please update post by running
which ruby
How to fix Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0
If you run ruby -v
you're going to see that you've installed Ruby 1.9.3, but the first line in your Gemfile specifies that you want to use Ruby 2.0.0.
You should either install Ruby 2.0.0 or change the first line in your Gemfile to specify Ruby 1.9.3.
sample of Gemfile:
source 'https://rubygems.org'
ruby "1.9.3"
gem 'pry'
gem 'pry-nav'
# Use with command-line debugging, but not RubyMine
#gem 'debugger'
gem 'bundler'
How to debug Ruby scripts
Use Pry (GitHub).
Install via:
$ gem install pry
$ pry
Then add:
require 'pry'; binding.pry
into your program.
As of pry
0.12.2 however, there are no navigation commands such as next
, break
, etc. Some other gems additionally provide this, see for example pry-byebug
.
Bundler::GemNotFound: Could not find rake-10.3.2 in any of the sources
bundle config set --local path 'vendor/cache'
generally fixes it as that is the more common problem. Basically, your bundler path configuration is messed up. See their documentation (first paragraph) for where to find those configurations and change them manually if needed.
Debugging with Torquebox and RubyMine
According to this comment it's already implemented and will be available in RubyMine 5.0 and next IDEA plug-in.
You can already try it in RubyMine 5.0 EAP.
Is it possible to do ruby-debug on a remote server?
ruby-debug has had out-of-process debugging for a long while. In fact the code mentioned in that Noufal Ibrahim cites, is using the same underlying common code.
However I've just added some documentation describing how it works in the reference manual.
See http://bashdb.sourceforge.net/ruby-debug.html#Remote-Debugging and http://bashdb.sourceforge.net/ruby-debug.html#Out_002dof_002dprocess-execution-options
How do I view the HTTP response to an ActiveResource request?
It's easy. Just look at the response that comes back. :)
Two options:
- You have the source file on your computer. Edit it. Put a
puts response.inspect
at the appropriate place. Remember to remove it. - Ruby has open classes. Find the right method and redefine it to do exactly what you want, or use aliases and call chaining to do this. There's probably a method that returns the response -- grab it, print it, and then return it.
Here's a silly example of the latter option.
# Somewhere buried in ActiveResource:
class Network
def get
return get_request
end
def get_request
"I'm a request!"
end
end
# Somewhere in your source files:
class Network
def print_request
request = old_get_request
puts request
request
end
alias :old_get_request :get_request
alias :get_request :print_request
end
Imagine the first class definition is in the ActiveRecord source files. The second class definition is in your application somewhere.
$ irb -r openclasses.rb
>> Network.new.get
I'm a request!
=> "I'm a request!"
You can see that it prints it and then returns it. Neat, huh?
(And although my simple example doesn't use it since it isn't using Rails, check out alias_method_chain
to combine your alias calls.)
Debugging with Torquebox and RubyMine
According to this comment it's already implemented and will be available in RubyMine 5.0 and next IDEA plug-in.
You can already try it in RubyMine 5.0 EAP.
Related Topics
Generating Sequential Numbers in Multi-User Saas Application
Emacs Ruby Method Parameter Indentation
Zip Up All Paperclip Attachments Stored on S3
Rails Routing: Giving Default Values for Path Helpers
Passing Local Variables to a View from Controller
Converting Video to Flash and Mp4 Ruby on Rails
Gemfile.Lock Always Has Changes Not Staged for Commit
How to Implement Composite Primary Keys in Rails
Normal Variables VS Instance Variable in Ruby, Whats the Difference
How to Scroll a Web Page Using Watir
Rails Include Only Selected Columns from Relation
Can't Install Therubyracer in Jruby
Ruby on Rails:How to Implement Cancel Button in Form_Tag
Why Do I Need Asterisk Before an Array
How to Change Case of Letters in String Using Regex in Ruby