Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby ActiveRecord Basics Introduction to ActiveRecord A Quick and Dirty Example

bin/rails vs rails differences?

Several commands in the Intro Rails course use "bin/rails" as the prefix, instead of rails: for example, bin/rails generate [name of model]. This tutorial uses "rails generate" instead. What is the reason for using the "bin" in front of rails commands? This is something that is rather difficult to google, for whatever reason.

Thanks

Ross Litzenberger
Ross Litzenberger
11,706 Points

The reason behind the bin/rails bin/rake is for speed. Command "time bin/rails s" you will every time you pass the command. The file will load faster.

Hi Ross Litzenberger ,

Is the command treated any differently with bin in front? And why is it faster?

Thanks

1 Answer

The reason behind bin/rails vs rails is different versions of rails. If you're running a current version of rails then it's fine to use the 'rails' command. But if you have a different version (say Rails 3.2) and you have Rails 4 installed then you need to use 'bin/rails' because you may run into issues with the 'rails' command.

https://github.com/rails/spring/issues/294