Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby on Rails: 4.2.0 differences between rails and bin/rails

So starting from Rails 4.1.x there seems to be a recommended way to use rails under the application folder. Instead of the traditional:

rails server

it is recommended by Rails official guide to use

bin/rails server

It looks like the bin/rails is referencing rails with additional stuff. What would be the additional benefits of using bin/rails compared to rails?

A second question is - I was used to use rails server, rails console, etc. rather than bin/rails server, bin/rails console. Without using bin/rails, would I lose anything (like misloading some libs, etc.)?

Thanks.

like image 955
Bruce Avatar asked Jan 05 '15 04:01

Bruce


Video Answer


1 Answers

Put the following line in your bin/rails file: puts "In the bin/rails file"

Now run rails server. You'll likely see that the rails command is executing the bin/rails file.

I'm guessing the official guide suggests using bin/rails for two reasons:

  1. Avoid using another instance of rails if your paths are not set up properly.
  2. Speed - bin/rails seems to be a bit faster than just rails
like image 128
NolanDC Avatar answered Oct 17 '22 15:10

NolanDC