PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, May 18, 2022

[FIXED] How can I render a child partial inside its parents partial?

 May 18, 2022     nested, partial, render, ruby-on-rails     No comments   

Issue

I have tables of venues, reviews and comments where a venue can have many reviews and a review can have many comments.

The reviews themselves are shown as partials on the venues show page using:

<%= render :partial => 'reviews/review', :collection => @venue.reviews %>

I thought using this:

<%= render :partial => 'comments/comment', :collection => @review.comments %>

inside the review partial would succesfully show the comments for that particular review but its just not displaying anything and giving no errors.

using <%= review.comments.count %> in the review partial does correctly show the number of comments added and checking the comments records in the console shows they have the correct foreign keys.

Any help is much appreciated!


Solution

"did you tried changing @review to review in second one? – rubish Jul 25 at 22:48"



Answered By - Dave
Answer Checked By - Clifford M. (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing