As with most programming answers...it depends.
The command /bin/rails
explicitly runs the rails command found in your system's /bin
direcory.
The command rails
causes bash to look in the directories listed in the special evironment variable $PATH
for the first command named "rails" that it finds. The directory bin
is usually in your $PATH and if the system finds the rails command there the /bin/rails
and rails
execute the same command.
If however, you happen to have another version of rails installed somewhere like /usr/bin/rails
and that is in your $PATH first then rails
might run that. In this case tehre might be a world of difference as the two commands could run diffrent versions of rails.
In general, unless you are explicitly trying to run a different version of rails than the one in your $PATH, it is best to call just rails g blah
as that is the one your system "assumes" to be the right one.
It is easy to figure out where the rails command lives on your system. Just run:
which rails
On my machine I get /usr/bin/rails
.
You can also take a look at your path:
echo $PATH
That will give a colon (:
) seperated list of directories which the system searches in the order they are lsited for commands you type into bash.
Once you find out where your rails lives, it is also interesting to take a look at what it does...try running this cat /usr/bin/rails
replacing the rails path with whatever it is on your machin.