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 Build a Todo List Application with Rails 4 Build a Todo List Application with Rails 4 Generate a Scaffold

not including prefix "bin/rails.." before generate scaffold....

Can you explain the diff. between including bin/rails before generate scaffold ... vs not prefixing it? my scaffolding did not show any errors but the content that showed in terminal also looks very different than what was shown in the video... ALSO when i leave out the "bin/" in the beginning, everything seems to work fine.... explanation please?

2 Answers

Stone Preston
Stone Preston
42,016 Points

at 13:52 he says he uses bin/rails that " because we're wanting to use the specific Rails tied to our application".

What happens when you type rails is that bash (the shell program running inside your terminal window" looks at your PATH variable and goes through all the directories in that path looking for a command called rails. When it finds it, it executes the program.

The problem is that if you could have multiple rails versions and it might not find the one you want to use. using bin/rails guarantees that it uses the version you want since its the rails thats in the bin directory of the current project

Fidel Torres
Fidel Torres
25,286 Points

Hello jay niceness

If you want to notes the difference you might need to run the following commands in your project directory:

$ rails -v
Rails 4.2.1
$ bin/rails -v 
Rails 4.0.1

In this case the version in the ./bin/ was different to the one in the ./ directory, So if in your case the two version are the same it won't make a difference do either bin/rails OR rails.

Hope it helps