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

Wednesday, May 18, 2022

[FIXED] How can I yield a "future" content_for tag in Rails 3?

 May 18, 2022     content-for, partial, ruby-on-rails-3, templates, yield     No comments   

Issue

I have a template with 2 partials. In the first one, I am yieleding content which is only defined in the second partial (with a content_for tag). The problem is that the yield does not recognize that content yet since it was not defined.

If I reverse the order of the partials the yield recognized the content, yet the layout is not as I desire obviously...

Is there a way to do this? Thank you.


Solution

Okay, this was actually an easy fix. I moved the second partial into a content_for block placed above the first partial, and then just yielded it instead of declaring it as a partial.



Answered By - Indigon
Answer Checked By - Senaida (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