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

  • Home
  • SEARCH
  • 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 8243687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:35:51+00:00 2026-06-07T21:35:51+00:00

My index action in my controller is something like this: @dbs = somearray My

  • 0

My index action in my controller is something like this:

@dbs = somearray

My view corresponding to this action (index.html.erb) is trying to print only the elements of the @dbs array but it prints no only the elements individually but the entire array as well (which I want to avoid printing). The code printing in index.html.erb is:

<%= for db in @dbs do %>
  <tr>
    <td><%= db %></td>
  </tr>
<% end %>

This prints:

["ele1","ele2","ele3"]
----
ele1
----
ele2
----
ele3
----

How can I avoid printing: ["ele1","ele2","ele3"]? I just want to print the table with the elements!

  • 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-07T21:35:53+00:00Added an answer on June 7, 2026 at 9:35 pm

    The construction <%= %> is printing into output, <% %> doesn’t print into output. Just change one line to this:

    <% for db in @dbs do %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I rendering a view partially like this. <%= render(:partial => index ,:controller=>controller_name) %> so
Im trying to do something like this: routes.MapRoute(Product, {product}/{id}, new { action = Product,
I'd like to have an Index action for a Users controller that takes an
Consider this MapRoute: MapRoute( ResultFormat, {controller}/{action}/{id}.{resultFormat}, new { controller = Home, action = Index,
my view: <form action=<?=base_url()?>index.php/frontend/main_con/temp> <input type=text name=temp> <input type=submit/> </form> Controller: function temp(){ echo
I have this link: <a href=<?php echo $this->url(array('controller'=>'index','action'=>'form'),NULL,TRUE);?>> Form </a> With this I get
I want a route something like this: MyController/Action/categoryid/productid So I made the following in
so i have a problem with :partial rendering... I have: index.html.erb view with content
Has anyone come across something like this before? Basically, I have an action on
I have a controller named Content, which has an Index action, which is associated

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.