--- 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. {` <% if Rails.env.production? %> <% end %> <%= yield(:title) || "My Rails App" %> <%= csrf_meta_tags %> <%= stylesheet_link_tag "application" %> <%= yield %> `} For more details, see the [Rails layout docs](https://guides.rubyonrails.org/layouts_and_rendering.html).