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.β¦