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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T12:22:40+00:00 2026-05-19T12:22:40+00:00

Suppose I have a model Person which has a one to many relationship with

  • 0

Suppose I have a model Person which has a one to many relationship with itself (i.e. Parent -> Child). When show.html.erb is rendered on a given @person I would like it to also include the result of rendering of show.html.erb for the parent.

Essentially I would like the correct syntax for

<%= render @person.person %>

I actually tried manually doing

<%= render :file => "/persons/1.html.erb" %>

and it didn’t work. Can someone help me understand the syntax of render? Thanks.

(Note that I actually have a more complicated model and I am rendering SVG files, not html.)

  • 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-19T12:22:41+00:00Added an answer on May 19, 2026 at 12:22 pm

    Put most of the content of show.html.erb in a file called _person.html.erb and then in show.html.erb have this:

    <%= render :partial => 'person', :locals => {:person => @person} %>
    

    Use person instead of @person in _person.html.erb

    (Note that the file name starts with an underscore.)

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

Sidebar

Related Questions

Suppose I have 2 models. The 2nd model has a one-to-one relationship with the
Suppose we have 2 classes, Child, and the class from which it inherits, Parent.
Suppose I have a Book model, which contains many Page models. The routing for
Suppose a Person object may have many Addresses but must have one Do you
Suppose I have a model Order, which has a column num -- an order
Suppose I have a model user , which has a uniqueness constraint on the
suppose I have a model and a view ,ths view have two method:one is
Suppose I have got a model ArticleVersion in my project which is defined as:
Here's my situation.. Suppose you have the following model entities, which represent single tables
Suppose I have an Account model which has_many Users. Accounts have a boolean active

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.