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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:50:26+00:00 2026-05-30T12:50:26+00:00

How can I display the details for a task in the same way (using

  • 0

How can I display the details for a task in the same way (using my _task partial) whether the view is using @project.tasks (ie multiple) or just @task (ie individual task)?

My question is similar to this one : How can you make a ruby function accept either an individual item or collection of items and do the same thing?

I tried checking if @project.tasks.is_a? but it complained wrong number of arguments (0 for 1).

Any ideas?

  • 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-30T12:50:27+00:00Added an answer on May 30, 2026 at 12:50 pm

    I’m not sure what you want, but I understood that you want to render partial either collection on individual item. So if I right you should follow these steps and everything will work out of box. Let’s say you have model Project and it has_many Tasks, the steps are:

    1. Rename your task partial to tasks/_task.html.erb
    2. Use in view (e.g. projects/show.html.erb) render like this: <%= render @project.tasks %>
    3. You able to use also render like this: <%= render @task %>

    Note: solution works for Rails >= 3.

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

Sidebar

Related Questions

Is there a command like time that can display the running time details of
in my android app i am using expandable list view to display some text.These
I'd like to display a Details view from a select row event on a
I am trying to display database details in a Flex datagrid and connected using
I have a View that displays the Customer Details. I would like to display
I am using php and mysql to grab and display details depending on the
Can anyone tell me how I can display a status message like 12 seconds
How i can display all applications icons and name which are installed in device
Possible Duplicate: Is there a tool that can display a SVN repository visually (
Examotion has a player that can display the image for svg files as a

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.