#ruby
#ror
#redis
How to create a blog without database — part1 It’s been a while since the latest rails version was released, I am a little bit curious about the experience of building a dead simple blog using rails 7 in late 2022. It will be a lot of fun of building a straightforward blog system by myself.
The tech stack I am going to use rails 7 + Redis + tailwind CSS to implement the system.
#ruby
#ror
#redis
Set up the routes Open the routes.rb file and define 3 new rules.
Rails.application.routes.draw do get 'posts/index' get 'posts/show/:file_name', to: 'posts#show', as: 'detail' get 'tags/:tag_name', to: 'posts#tag', as: 'tag' root "posts#index" end Make the default root path point to the post index page, that is what we expected.
Create controller In the terminal, use the rails generator to create a new controller, as respect to the rails’ convention, I will use posts as the controller’s name instead of post.
#ruby
#ror
#redis
#deploy
#capistrano
Background I used to use mina to deploy all my rails applications, but it seems that it is not incompatible with rails 7, that makes capistrano the best and only choice for the deployment.
Install capistrano plugins The following plugins are required.
# Gemfile group :development do gem "capistrano", "~> 3.17", require: false gem "capistrano-rails", "~> 1.6", require: false gem 'capistrano3-puma', require: false gem 'capistrano-rbenv', '~> 2.2', require: false gem 'capistrano-bundler', '~> 2.