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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:35:10+00:00 2026-06-16T06:35:10+00:00

Creating a simple todolist. Trying to show the description for a task that belongs

  • 0

Creating a simple todolist. Trying to show the description for a task that belongs to a list in the list index view. With the current code all data fields shows up from all tasks that belongs to the list when i use list.tasks, but i only want the task.desc. How do i specifically tell rails that i only want the task.desc to show up?

lists/index.html.erb

<h1>My Lists</h1>

        <%= link_to 'New List', new_list_path, class: "btn btn-primary" %>

        <h3>Name | Time Ago</h3>

    <% @lists.each do |list| %>

        <h4><%= link_to list.name, list %></td></h4>

        <% if list.created_at > Time.now.beginning_of_day %>
        <%="#{time_ago_in_words(list.created_at)} ago"%>
        <% else %>
        <h6><%= list.created_at.strftime("%b %d, %Y") %></h6>

        <%= list.tasks %><br />
            <% end %>


        <%= link_to 'Edit', edit_list_path(list) %> | 
        <%= link_to 'Destroy', list, method: :delete, data: { confirm: 'Are you sure?' } %>
        <br />
    <% end %>
    <br />
  • 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-16T06:35:11+00:00Added an answer on June 16, 2026 at 6:35 am

    If i understand correctly your problem, you can use .each, which you have used for list iteration:

    <% list.tasks.each do |task| %>
      <%= task.desc %><br />
    <% end %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Am following the tutorial here on creating a simple todo list app: http://www.mydroid.apnafundaz.com/2010/07/todolist-application-in-android-step-by-step-guide-with-screen-shots/ Have
I've been creating simple GAE project - all what I did before is index.html.
I am creating simple app on Silverlight 4. In folder of View I have
Creating a simple RPG game, first time using XNA. Trying to get my character
I'm creating a simple file walker to list some files and need to omit
I'm creating a simple Java wrapper for git executable, that I want to use
I am creating a simple script say a.php. I know that drupal 6 creates
i am creating simple side menu, such that when the user hover on item
I'm creating simple form validation that excludes any entries that have a letter in
I'm creating simple proxy server but I faced a strange situation, I've following code

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.