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 8262755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:51:42+00:00 2026-06-08T03:51:42+00:00

From one ERB view, I have this helper call: <p><%=progress @object.progress %></p> This is

  • 0

From one ERB view, I have this helper call:

<p><%=progress @object.progress %></p>

This is the helper method (I’ve simplified it):

def progress(value)
    s = content_tag(:span, "pre:")
    s += " <strong>#{value} %</strong>"
    return s.html_safe
end

It seems that if you merge those two types of HTML strings, the latest part is not rendered properly. You’ll see this:

pre: <strong>40 %</strong>

If you combine the strings like so:

def progress(value)
    s = content_tag(:span, "pre:")
    s += content_tag(:strong, " #{value} %")
    return s.html_safe
end

everything work!

  • 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-08T03:51:43+00:00Added an answer on June 8, 2026 at 3:51 am

    String returned from content_tag is marked as html_safe, when you add other unsafe string it’s escaped before concat.

    Here’s a nice explanation on how the SafeBuffers (the class that does the html_safe magic) work: http://yehudakatz.com/2010/02/01/safebuffers-and-rails-3-0/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one HTML file located in app/views/layouts/application.html.erb I use <%=yield=> to render the
I am doing Ajax Call from View, then controller is fetching data from DB
I have a _form.html.erb partial that comes from the standard rails 3 template for
we can remove formula from one cell by cell.setCellFormula(null) . but if i want
I am send data from one service to other service using parecable, when I
When sending data from one iOS device to another, I receive these errors. 2012-06-21
We're migrating from one server to another and a VBA script to save attachments
I am pulling data from one table, called analyzedCopy, and using it to over-rite
History: I read from one of Knuth's algorithm book that first computers used the
I want to graph from one date to another date and i only partial

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.