Nicolas Cavigneaux
2007-Jan-18 14:23 UTC
Throw default text when yield doesn''t render anything ?
hello, I''m wondering if there''s a way to do something like : <%= yield :catchphrase || "default text" %> ? Thanks. -- Nicolas Cavigneaux http://www.bounga.org http://www.cavigneaux.net --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Nicolas Cavigneaux
2007-Jan-18 14:27 UTC
Re: Throw default text when yield doesn''t render anything ?
Le 18 janv. 07 à 15:23, Nicolas Cavigneaux a écrit :> > hello, > > I''m wondering if there''s a way to do something like : <%= > yield :catchphrase || "default text" %> ?<%= yield(:catchphrase) || "default text" %> works, sorry. -- Nicolas Cavigneaux http://www.bounga.org http://www.cavigneaux.net --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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 -~----------~----~----~----~------~----~------~--~---
augustlilleaas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jan-18 15:41 UTC
Re: Throw default text when yield doesn''t render anything ?
About time someone deprecate <%= @content_for_foo %> too. You should go <%= yield(:foo) %> instead, and do <% if yield(:foo) %> (or perhaps unless yield(:foo).empty? Not sure) if you need to check if it has contents. Yield ftw! On Jan 18, 3:27 pm, Nicolas Cavigneaux <n...-DRabjd/C3MEdnm+yROfE0A@public.gmane.org> wrote:> Le 18 janv. 07 à 15:23, Nicolas Cavigneaux a écrit : > > > > > hello, > > > I''m wondering if there''s a way to do something like : <%= > > yield :catchphrase || "default text" %> ?<%= yield(:catchphrase) || "default text" %> works, sorry. > -- > Nicolas Cavigneauxhttp://www.bounga.orghttp://www.cavigneaux.net--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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 -~----------~----~----~----~------~----~------~--~---