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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:58:19+00:00 2026-06-12T00:58:19+00:00

I am doing some erb exercises and tests but i can’t seem to find

  • 0

I am doing some erb exercises and tests but i can’t seem to find how to split a stupid line that is too long in my editor. I’ve already tried using \n and \ but it doesn’t work as soon as I run it in terminal.

Here is the code:

erb_string = "

 <h1><%= me[:name] + '\\'s ' + 'Blog'%></h1>

 <ul>
    <% animals.each do |animal| %>
    <li><%= animal.upcase.reverse %></li>
<% end %>
 </ul>

 <p><%= 'My name is ' + me[:name] + ', my eyes are ' + me[:eyes] + '.' %></p>

 <p><%= 'Let\\'s do some numbers! '  + numbers.last.to_s + '! is ' + numbers.inject(:*).to_s %></p> # I want to split this line in my editor because it is too long.
"
  • 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-12T00:58:21+00:00Added an answer on June 12, 2026 at 12:58 am
       <p><%= 'Let\'s do some numbers! '  + \
       numbers.last.to_s + '! is ' + \
       numbers.inject(:*).to_s %></p>
    

    this should work.
    if it didn’t work it was probably because you used two backslashes to escape the single quote and the first backlash escaped the second one so the single quote was not escaped.

    Btw, when you have a string containing single quotes, you’d better encapsulate that in double quotes so you don’t have to escape the single quotes.

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

Sidebar

Related Questions

While doing some JavaScript performance tests I came up with the following piece of
While doing some refactoring I've found that I'm quite often using a pair or
I have the following code in my application.erb.html $alertdiv.text(some message); but I need to
Just doing some Rails and noticed that when displaying 30 products on a single
After doing some initial research into using Appfabric for caching, my understanding is that
Apologies if this is asked before, but I can't find it... I've got a
In some project i met this code: erb = yield.src I can't understand what
Doing some jquery animation. I have certain divs set up with an attribute of
Doing some homework here (second assignment, still extremely green...). The object is to read
In doing some bioinformatics work, I've been pondering the ramifications of storing object instances

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.