DEV Community

Arhan Khan
Arhan Khan

Posted on

Ruby on Rails for Beginners: Build Web Apps Fast

Ruby on Rails, usually just called Rails, is a web framework that values developer speed above almost everything else. It gives you a database, routing, views, and background jobs out of the box, so a working app — signup, login, posting, comments — can exist within a day of starting.

Create a new app and a resource in two commands:

rails new blog
cd blog
rails generate scaffold Post title:string body:text
rails db:migrate
Enter fullscreen mode Exit fullscreen mode

That one scaffold generates the model, the database table, the controller, the views, and the routes. Start the server and you already have a working blog:

rails server
Enter fullscreen mode Exit fullscreen mode

Routing in Rails follows convention over configuration. This line creates all seven standard routes for posts:

# config/routes.rb
Rails.application.routes.draw do
  resources :posts
end
Enter fullscreen mode Exit fullscreen mode

Models are equally small. Validations, associations, and queries read almost like English:

class Post < ApplicationRecord
  validates :title, presence: true
  has_many :comments, dependent: :destroy
end

Post.where("title LIKE ?", "%rails%").order(created_at: :desc)
Enter fullscreen mode Exit fullscreen mode

Who is it for? Beginners who want to see a full working app quickly, and founders or solo developers who need to ship fast. Startups like Shopify, GitHub, and Airbnb all started on Rails for exactly this reason.

The limits: Rails apps can get slow if they grow without care, and the magic that makes it fast to start can confuse beginners when something breaks — you need to understand what the framework did for you. Hiring Rails developers is also harder than hiring JavaScript developers in some markets.

Start today: build the scaffold blog above, then add comments to it by hand. By the end of the day you will have a real CRUD app and a real sense of how Rails thinks.

Top comments (0)