Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7767517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:41:52+00:00 2026-06-01T15:41:52+00:00

In a Rails 3.2 app I define the page title using <% title Title

  • 0

In a Rails 3.2 app I define the page title using <% title "Title Text" %>.

This is passed to the <title> tag as follows:

<head>
    <title>AppName | <%= yield (:title) || "Default Title" %></title>
</head>

and rendered as follows:

<h1><%= yield(:title) %></h1>

by the following helper method:

def title(page_title, show_title = true)
    content_for(:title) { h(page_title.to_s) }
    @show_title = show_title
end

def show_title?
    @show_title
end

This works as expected in development, and works in most cases in production on Heroku.

In a few places I have more complex titles, e.g. <% title ["Edit ",(@model.name)] %>.

This works as expected in development, and displays Edit Foo Bar.

But on Heroku this is rendered as ["Edit ", "Foo Bar"].

Why is the syntax being rendered on Heroku? I have a feeling that this may be related to using square brackets to define an array, but after searching the Heroku docs and Google I haven’t found any information about this.

Thanks for any ideas to help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T15:41:53+00:00Added an answer on June 1, 2026 at 3:41 pm

    It sounds like you’re using Ruby 1.8 at home while Heroku is using 1.9 — Array#to_s gives different results between the two. To avoid the ambiguity, it’s best to be explicit about how you want arrays to be printed. For example, if you want your title helper to handle arrays specially, something like this should work:

    def title (page_title, show_title =true)
        page_title = page_title.join(' ') if page_title.respond_to? :join
        base_title = "AppName"
        @content_for_title = page_title.to_s
        @show_title - show_title
        if @content_for_title.nil?
          base_title
        else
          "#{base_title} | #{@content_for_title}"
        end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating test data for a Rails app. How do I define the value
My rails app crashes as soon as I access a web page. My versions
Whats the proper way to set the page title in rails 3. Currently I'm
Is there a way to globally define a rails app to only serve json
In my Rails app, I am used to using syntax like the following in
Using Rails 3.1.3 with Devise 1.5.3. My app has accounts and users. Each account
In my rails app, i am using a legacy database. class Expression < ActiveRecord::Base
In a Rails 3.2 app I have two user models set up using Devise:
I am using the make_resourceful plugin in my Rails app, and attempting to use
I'm using pagination on our Ruby on Rails app and the pages are defined

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.