Re: [Rails] how to use mutiple yields
On 12 November 2011 04:38, Nike Mike <lists@ruby-forum.com> wrote:
> In my layout, i have mutiple layouts.
> Is there any way to reduce to a single line.Currently my layout likes
> this
If you *really* want to (though I don't know why you would...)
<% [:head, :foot, :bottom].each do |to_yield| %><%=yield to_yield %> <%end%>
Although strictly, that's still three lines...
How about
<%=yield :head%><%=yield :foot%><%=yield :bottom%>
;-)
> How to call this in a single method
You could also move those three lines into a partial, and render that
with a single line in your layout.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home