Ruby on Rails console is hanging when loading
Restarting Spring should fix the hanging commands:
$ bin/spring stop
I experienced hanging commands (rake, bin/rails, etc.) after deleting and recreating a new Ruby on Rails application. Google wasn't that helpful. I hope this is.
Spring will start automatically when you re-run your command.
Console not loading server
rails console
isn't supposed to run the server. It's the console, and you just mess with it, typing stuff inside and getting replies from it via on-screen text messages.
Everything's working fine, you may continue venturing into the mysterious and rewarding world of Ruby on Rails development.
Why all constants not loading on pry console in rails project root dir?
To expand on the comments, what's being said is to install the pry-rails
gem in your Gemfile.
pry
alone works the same as irb
(a Ruby console, outside of the project's context), while using pry-rails
means rails c
will load using pry
with all its functionality. And therefore access to the required constants.
This will also allow you to use the binding.pry
breakpoints within the code, as desired.
Alternatively, if you load rails c
with the pry
gem installed, you should be able to run the command pry
within that (you might need to require 'pry'
ahead of this), and it jump to using pry
within the project's context. This will be handy if you're not able to add the pry-rails
gem to the project's dependencies.
(Whew - that's a lot of 'pry's
.)
Hope that helps - let me know if you've any questions.
rails console doesn't start
I may be answering a bit late for this, but for the sake of the others who are looking for the answer... it's here
Basically, enter this command
spring stop
The issue , as far as I understand, is with the spring
gem, specifically, it checks the server for versions, which doesn't tally up.
For my case, the problem started when when I add some new gems into the gemfile.
So once you stop spring and type in any other rails command, spring restart, and every thing should work again, at least until the same problem occurs, or the dev patched the issue.
Related Topics
How to Save a Base64 String as an Image Using Ruby
Rails 3 Disabling Session Cookies
Which Style of Ruby String Quoting Do You Favour
How Does Load Differ from Require in Ruby
How to Display Ruby on Rails Form Validation Error Messages One At a Time
Difference Between Ruby and Ruby on Rails
How to Set Up the Database.Yml File in Rails
Find Key/Value Pairs Deep Inside a Hash Containing an Arbitrary Number of Nested Hashes and Arrays
How to Deal With the Sum of Rounded Percentage Not Being 100
Ruby Regular Expression to Match a Url
Why Would One Use the Unary Operator on a Property in Ruby? I.E &:First
Is Order of a Ruby Hash Literal Guaranteed
What Are the Benefits of the New Hash Syntax in Ruby 1.9
How to Have Class.Property = X Return Something Other Than X