Rails not booting in debug - ruby-on-rails

I did:
gem install ruby-debug
Then it installs...
I launched using:
rails server -u -p 3002
(I also tried with -d)
I get this:
=> Booting WEBrick
=> Rails 3.0.1 application starting in development on http://0.0.0.0:3002
=> Call with -d to detach
=> Ctrl-C to shutdown server
You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
Exiting

You need add ruby-debug in your Gemfile
gem 'ruby-debug'

Related

Running Rails S with a fresh new app returns ERR_EMPTY_RESPONSE

I am using Vagrant to start a Rails app, everything seems right but then, when I create a test app, run rails s and go to localhost:3000 I get a ERR_EMPTY_RESPONSE and nothing is loaded. I get the following output when running rails s:
vagrant#rails-dev-box:~/projects/NewAppName$ rails s
=> Booting WEBrick
=> Rails 4.2.3 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2015-08-20 11:45:45] INFO WEBrick 1.3.1
[2015-08-20 11:45:45] INFO ruby 2.2.1 (2015-02-26) [i686-linux]
[2015-08-20 11:45:45] INFO WEBrick::HTTPServer#start: pid=12075 port=3000
I already ran rake db:create && rake db:migrate, and created a controller for the root. Anyone has an idea of what can be happening? Thank you.
It's in localhost on vagrant, so you can't connect it.
Try rails s -b 0.0.0.0 and then connect to vagrant IP(192.168.50.4:3000, for example).

rails commands and rake are dumping unwanted list of all gems

It is very strange. I even tried a brand new project:
rails new abc
cd abc
rails s
The output is:
=> Booting WEBrick
=> Rails 4.1.1 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
active_support/descendants_tracker
active_support/core_ext/module/delegation
active_support/core_ext/object/to_param
active_support/core_ext/regexp
... lots more here
active_support/core_ext/array/extract_options
rack/utils
action_controller/metal/exceptions
[2015-04-23 19:35:42] INFO WEBrick 1.3.1
[2015-04-23 19:35:42] INFO ruby 2.1.2 (2014-05-08) [x86_64-darwin13.0]
[2015-04-23 19:35:42] INFO WEBrick::HTTPServer#start: pid=12738 port=3000
It doesn't break anything, but it makes reading output to debug very difficult.
It happens for all usage of rails and rake, in or out of bundle exec, but not bundle commands like bundle list or bundle install
Strangest thing... but it went away when I updated from rails 4.1.1 to rails 4.2.1

mri_21 is not a valid platform

Hi i switched my Ruby on Rails development platform from Windows 7 to Linux (Debian), I copied entire app directory to Linux and run bundle installand the command was successful. Than i run rake db:migrate and it quit with following error:
`mri_21` is not a valid platform. The available options are: [:ruby, :ruby_18, :ruby_19, :mri, :mri_18, :mri_19, :rbx, :jruby, :mswin, :mingw, :mingw_18, :mingw_19]
Than i Googled for the error and found this, i followed the suggested steps, i.e.:
gem update bundler
above command output:
Updating installed gems
Nothing to update
Than: bundle install and this was also successful.
But still getting same error on rake db:migrate
my ruby version: ruby 1.9.3p194
unable to get rails version by rails -v getting the same mri_21 error but in my app's Gemfile i have gem 'rails', '4.1.5'
EDIT: But when i tried bundle exec rake db:migrate it was successful. and than i run bundle exec rails s and app running successfully :
=> Booting Thin
=> Rails 4.1.5 application starting in development on 0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
>> Thin web server (v1.3.1 codename Triple Espresso)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop
Now my question is, how to get rid of this bundle exec every time, and what's going on with this.
Since bundle exec just fixes the PATH, and GEM_PATH variables, you should have all the gem binaries in the PATH variable before that are specified to wrong versions of rails, and gems. Also set GEM_PATH properly. So you be able to avoid the bundle exec call. All the values you are able to know with calls:
$ bundle exec echo GEM_HOME=$GEM_HOME\; GEM_PATH=$GEM_PATH\; PATH=$PATH
GEM_HOME=/home/malo/.rvm/gems/ruby-2.1.4; GEM_PATH=/home/malo/.rvm/gems/ruby-2.1.4:/home/malo/.rvm/gems/ruby-2.1.4#global; PATH=/home/malo/.rvm/gems/ruby-2.1.4/bin:/home/malo/.rvm/gems/ruby-2.1.4#global/bin:/home/malo/.rvm/rubies/ruby-2.1.4/bin:/home/malo/.rvm/bin:/usr/local/heroku/bin:/home/malo/.rbenv/bin:/home/malo/bin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/usr/games:/usr/lib/qt4/bin

Specify which server a rails project will use

Just wondering if this can be done. You can specify you want a new rails project to use the postgresql server ike this:
rails new my-new-rails-project -d postgresql
and that takes care of the database yaml file.
Can an option be passed in here to specify puma as the development and production server so the relevant puma.rb configuration file is created?
Something like this:
rails new my-new-rails-project -d postgresql -s puma
By default Rails are using Webrick, but you can include different gem using Gemfile.
For example, you can use Thin (or puma, unicorn, whatever...) gem to your Gemfile and install it with bundler.
gem 'thin', group :development
When you start local server, rails will boot with custom webserver
rails server
=> Booting Thin
=> Rails 4.0.1 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Thin web server (v1.6.1 codename Death Proof)
Maximum connections set to 1024
Listening on 0.0.0.0:3000, CTRL+C to stop
There is no option for server configuration in Rails. You can check using below command.
rails new --help

Rails console - process finished with exit code 0

Can't start rails console. When I'm trying to start it I 've got this message:
Loading development environment (Rails 3.2.12)
Process finished with exit code 0
It exits without any errors. But rails server starts without problems:
=> Booting WEBrick
=> Rails 3.2.12 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2013-04-26 02:23:44] INFO WEBrick 1.3.1
[2013-04-26 02:23:44] INFO ruby 1.9.3 (2013-02-22) [x86_64-darwin12.2.0]
[2013-04-26 02:23:44] INFO WEBrick::HTTPServer#start: pid=2393 port=3000
I'm running Mac OS X with rvm.
Why rails console may not be working?
Did you try with bundle exec?
bundle exec rails c
If you're using RVM, try doing rvm implode and reinstall Ruby and Rails.

Resources