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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:04:17+00:00 2026-06-17T17:04:17+00:00

I am creating a section of my Rails application for the visually impaired. This

  • 0

I am creating a section of my Rails application for the visually impaired. This requires me to create it using only text and links in order to make it easier for people using speech readers to navigate through. I want to use fields from an existing model to dynamically build a link_to command. I would like to be able to build a variable using several fields on the model that contains the text that a user clicks on and another field from the model which contains the link.

Here is the code in my controller:

MediaLibrary.find(:all, conditions: ["media_type_id < ?", 3], limit: 5).each do |media_item|
  @audio_links["link_text"] = "Audio of #{MediaCreator.find(media_item.media_creator_id).name} #{media_item.media_created.to_time.strftime('%A, %B %d, %Y')} at #{media_item.meeting_time}
   #{media_item.am_pm} - #{media_item.name}" 
  @audio_links["link"] = media_item.link
end

Here is the code in my view:

<% @audio_links.each do |audio_link| %>
  <li>
    <%= link_to audio_link["link_text"], '#{audio_link["link"]}'  %>
  </li>
<% end %>

I have also tried the following:

<% @audio_links.each do |audio_link| %>
  <li>
    <%= link_to 'audio_link["link_text"]', '#{audio_link["link"]}'  %>
  </li>
<% end %>

And this:

<% @audio_links.each do |audio_link| %>
  <li>
    <%= link_to '#{audio_link["link_text"]}', '#{audio_link["link"]}'  %>
  </li>
<% end %>

I have tried a few more variations but I either get the can’t convert String into Integer error on the link_to command when I attempt to display the screen or the links display with the text being displayed as the following. When this happens I get other errors when I click the link.

#{audio_link["link_text"]}

I have done a lot of searches on Stack Overflow and throughout the web. I have not found a single example of this being done anywhere. I have seen in older posts where there was a set_path command (2010) but nothing for recent posts. I have used html_safe! before and will add that to my code. I do not know if there is a problem with my code or if I am attempting something that is not possible. I sincerely hope this is possible because it will make it easier for people with speech readers to know what they are clicking on.

Any help with this would be appreciated.

  • 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-17T17:04:18+00:00Added an answer on June 17, 2026 at 5:04 pm

    You can’t do string interpolation in single quotes. Replace the single quotes with double quotes and your variables will be expanded properly.

    For example:

    <%= link_to audio_link["link_text"], "#{audio_link['link']}"  %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a rails application, in which i have to create a tutorials
I am working on creating a form section which shows input fields (either text
Has anyone seen this error before? An error occurred creating the configuration section handler
I've made a NSIS script to create an installer for a Rails application. The
I am attempting to take a whack at creating my first Rails application template
I am creating an online application with five sections. Each section will have its
What is the best approach for creating a 3 section (left, right, center) report
I am thinking about creating a new repository in SVN for a section of
I'm creating aggregations and setting a filter in the advanced section. eg: x.category ==
I want to create a textbox on the fly (in the comment section im

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.