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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:56:12+00:00 2026-05-14T00:56:12+00:00

I want to display the column ‘name’ after being found from the table mytest.

  • 0

I want to display the column ‘name’ after being found from the table mytest.

In the mytest.rb, I defined “attrib_accessor :name”;

In the procedure index under directory /controller/mytest_controller.rb,

def index
###[Ignore some code]
@mytesttbl=@user.find_by_id 
### I am able to verify the tuples in @mytesttbl
end 

In the /view/mytest/index.rhtml, I have code like

<div id="mytesttable"> <%= render(:partial =>"mytesttbl", :object => @mytesttbl)%> </div> 

In the /view/mytest/_mytesttbl.html.erb. I have code like

<tr>
 <td><%=mytestbl.name %></td>
<tr>

when I ran the above code, I have error on _mytesttbl.html.erb,

undefined method 'name ' for #<Array:0xb6c971cc>

Please help. Thanks,

  • 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-05-14T00:56:13+00:00Added an answer on May 14, 2026 at 12:56 am

    I’m guessing that’s not your actual code since it wouldn’t actually work. Your find is returning an array. You either want to loop through the array or, if you know it contains only one object (as in the case where you actually are finding by a unique id), you can just do mytesttbl.first to get the object out of it.

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

Sidebar

Related Questions

I want to display the TIME field from my mysql table on my website,
I want to display tabular type data, but it will not be coming from
I've got to create a standard view but I want to display column names
Using .net 2.0 . I want to display a column in a DataGridView as
I've got a QTableView for which I want to display the last column always
Using vlookup, when a match occurs, I want to display the value of column
i want to display two columns in datagrid view . first by sql-table second
I have a view like this: CREATE VIEW MyView AS SELECT Column FROM Table
At run time I want to dynamically build grid columns (or another display layout)
I want to display dates in the format: short day of week, short month,

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.