jotacode.dev

rails commands

Published on
1 min read
rails commands

Common Ruby and Ruby on Rails Commands for Local Development

Running a Rails Server

rails server

Generating a New Rails Project

rails new my_project

Generating a Scaffold

rails generate scaffold Post title:string body:text

Running Migrations

rails db:migrate

Rolling Back Migrations

rails db:rollback

Starting the Rails Console

rails console

Installing Gems

bundle install

Updating Gems

bundle update

Running Tests

rails test

Precompiling Assets

rails assets:precompile

Happy coding!

Read More
Routes in Rails

Routes in Rails

Routes in Rails are responsible for mapping URLs to actions in controllers, allowing the framework to know how to respond to different HTTP requests. Routes are defined in the config/routes.rb file and follow a simple yet powerful syntax.