Rediscovering the Joy of Rails with meta-tags Gem
After spending about a year working mostly with Java and Spring Boot, I recently returned to Rails to build a blog-focused Rails app and explore features from the new Rails 8 release. And I have to say: Rails feels like home.
One of the first gems I added was meta-tags. Setting it up reminded me how clean and intuitive the Rails ecosystem is, especially when gems follow the “Rails way.” That might be my bias speaking (I've been using Rails for 5+ years).
Adding SEO meta tags with this gem is simple and declarative.
How to Set Up meta-tags
in Rails 8+
1. Add the gem and install it
Option 1: Manually edit the Gemfile
and run:
# Gemfile
gem 'meta-tags', '~> 2.22'
bundle install
Option 2: Use the one-liner to install:
bundle add meta-tags
2. Setup the base helper in your layout
In your app/views/layouts/application.html.erb
, add this inside the <head>
tag:
<%= display_meta_tags %>
This will render your meta tags for each page.
3. Add the helper method to ApplicationController
In app/controllers/application_controller.rb
, add a before_action that sets up default meta tags, while still allowing page-specific overrides:
class ApplicationController < ActionController::Base
before_action :prepare_meta_tags
private
def prepare_meta_tags(options = {})
site_name = "Awesome Application"
title = options[:title] || "Awesome Application - Blog Post 1"
description = options[:description]
current_url = request.original_url
defaults = {
site: site_name,
title: title,
reverse: true,
description: description,
og: {
url: current_url,
title: title,
description: description,
type: 'website'
},
twitter: {
card: 'summary',
site: '@twitter-handle',
title: title,
description: description
}
}
set_meta_tags(defaults)
end
end
4. Customize meta tags per page
In your controller actions, you can override the defaults:
def show
@post = Post.find(params[:id])
prepare_meta_tags(
title: @post.title,
description: @post.summary
)
end
That's it! Minimal and declarative.
Why This Small Detail Felt So Rewarding
Gems like meta-tags reminded me why I return to Rails for personal and experimental projects: it's productive, elegant, and mentally freeing. You write less boilerplate and code with more intention.
This joy is even more amplified now, as AI assistants accelerate how quickly we can build and iterate. Some languages and frameworks are adapting to support LLM-assisted development. In my view, Rails is already ahead of the curve. Its consistent conventions and expressive syntax make it a perfect match for AI-assisted workflows.
This is really just an extension of what Ruby already excels at: readability. Rails inherits that clarity. It's easy to generate, easy to edit, and even easy to monkey-patch when needed, which is a powerful thing for solo builders and small teams shipping fast.
And just to be clear: this post isn't meant to bash Java. Over the last year, I've gained real appreciation for its power. Especially the newer language features and the strength of its interface-driven architecture and extensibility. But Rails will always hold a special place in my toolkit. It's where I feel the fastest and most creative.