- Convert MDX CodeBlock components to standard markdown code fences - Add rehype-mdx-code-props to pass filename meta to code components - Custom pre/code MDX components map fences to CodeBlock - Add brand color badges (product + category) matching /learn layout - Match prose styling: orange inline code, orange links, white strong - Remove brand color background glow (not in /learn)
45 lines
1.0 KiB
Plaintext
45 lines
1.0 KiB
Plaintext
---
|
|
title: "Ruby on Rails"
|
|
description: "Add Pulse analytics to your Ruby on Rails app. ERB layout integration."
|
|
category: "backend"
|
|
brandColor: "#D30001"
|
|
officialUrl: "https://guides.rubyonrails.org"
|
|
relatedIds: ["laravel", "django", "jekyll"]
|
|
date: "2026-03-28"
|
|
---
|
|
|
|
Add the Pulse script to your application layout with a production environment guard.
|
|
|
|
---
|
|
|
|
## Add to your application layout
|
|
|
|
Use an `if` guard to only load the script in production.
|
|
|
|
```erb filename="app/views/layouts/application.html.erb"
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
<% if Rails.env.production? %>
|
|
<script
|
|
defer
|
|
data-domain="your-site.com"
|
|
src="https://pulse.ciphera.net/script.js"
|
|
></script>
|
|
<% end %>
|
|
|
|
<title><%= yield(:title) || "My Rails App" %></title>
|
|
<%= csrf_meta_tags %>
|
|
<%= stylesheet_link_tag "application" %>
|
|
</head>
|
|
<body>
|
|
<%= yield %>
|
|
</body>
|
|
</html>
|
|
```
|
|
|
|
For more details, see the [Rails layout docs](https://guides.rubyonrails.org/layouts_and_rendering.html).
|