During the excellent flickr video, the presenter
adds the following to the applications layout file:
What is the purpose of the ‘yield’ line? I would think
there would be a content_for_layout tag there instead.
Thanks,
Don
During the excellent flickr video, the presenter
adds the following to the applications layout file:
What is the purpose of the ‘yield’ line? I would think
there would be a content_for_layout tag there instead.
Thanks,
Don
On 12/16/05, don mc [email protected] wrote:
What is the purpose of the ‘yield’ line? I would think
there would be a content_for_layout tag there instead.Thanks,
Don
It has to do with the way the layouts are built. Yield is just a
shortcut. You can also do:
<%= yield :foo %> instead of @content_for_foo.
–
rick
http://techno-weenie.net
Hi Don,
On 12/16/05, don mc [email protected] wrote:
What is the purpose of the ‘yield’ line? I would think
there would be a content_for_layout tag there instead.
You can say <%= yield %> instead of <%= @content_for_layout %> and,
e.g., <%= yield :sidebar %> instead of <%= @content_for_sidebar %>.
Here’s the relevant magic:
http://dev.rubyonrails.org/browser/trunk/actionpack/lib/action_view/base.rb?rev=3314#L292
–
sam
Sam S. wrote:
Hi Don,
On 12/16/05, don mc [email protected] wrote:
What is the purpose of the ‘yield’ line? I would think
there would be a content_for_layout tag there instead.You can say <%= yield %> instead of <%= @content_for_layout %> and,
e.g., <%= yield :sidebar %> instead of <%= @content_for_sidebar %>.Here’s the relevant magic:
http://dev.rubyonrails.org/browser/trunk/actionpack/lib/action_view/base.rb?rev=3314#L292–
sam
Thanks all for the quick response!
Don
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs