Ruby Ruby on Rails 5 Basics Creating an App Our First Resource

bin/rails not working ?

When entering this line joshuas-MacBook-Pro:~ joshua$ bin/rails generate scaffold Post title:string I receive this response -bash: bin/rails: No such file or directory

What could be the problem?

3 Answers

Jay McGavren
Jay McGavren
Treehouse Teacher

Does running ls bin/ produce output like this?

$ ls bin/
bundle  rails  rake  setup  spring  update

If you instead get ls: cannot access 'bin/': No such file or directory, you need to change into your Rails app's directory before running bin/rails.

how to do this ? how to change directory

Got everything working. Thanks!

bin/rails scaffold post title:string rails aborted! Don't know how to build task 'scaffold' (see --tasks)

How do I fix this issue?

Jay McGavren
Jay McGavren
Treehouse Teacher

victor manda , you need the generate command before the word scaffold:

bin/rails generate scaffold Post title:string

Make sure that Post, your model name, is capitalized as well.

Be careful not to make any mistakes with these generate commands! Check that the capitalization (Post vs. post) and pluralization (Post vs. Posts) of each word matches the tutorial. If you make a mistake on the command line, you may have hard-to-diagnose problems later.