DEV Community

Nashmeyah
Nashmeyah

Posted on

Setting up a Ruby on Rails Project

Before setting up a Ruby on Rails project, you have to make sure that you have the latest version installed on your machine. If you have Ruby installed, check the version by typing

ruby -v
// then type 
gem --version
Enter fullscreen mode Exit fullscreen mode

If you get an error that means you don't have Ruby, download the installation package from https://rubyinstaller.org/. Follow the link and then run the installer.

Now that's done, its time to set up the Rails installation,

gem install rails
Enter fullscreen mode Exit fullscreen mode

Create a new repo on GitHub. Clone the repo in your command line, within the directory you want to type this line of code,

rails new *name of your app or project*
// ex: rails new myProject
Enter fullscreen mode Exit fullscreen mode

Now after you open your vscode, you can start the rails server to see your work live with the command

rails server // or rails s
Enter fullscreen mode Exit fullscreen mode

Optional

The above steps set you up with blank files and folders so you can start building from scratch. But, there is an option where you can scaffold folders and files for an already setup MVC structure with a database as well.

rails generate scaffold Project name:string 
Enter fullscreen mode Exit fullscreen mode

That's it! Youre all set up with the bare bones of a Ruby on Rails application. Let me know if there are any other clarifications you would like me to go over! Enjoy!

Top comments (0)