Hi! This is what I want.... blog | photos | about This is what my code gives me..... blog | photos | about | The last "|" is to much.... [code] <% for page in @menu_pages %> <li><%=page%></li> <li>|</li> <% end %> [/code] Is there any way I can get some sort of indication whether the array @menu_pages has a next element? -- Jelle --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Mon, 2007-07-02 at 14:07 -0700, Jolé wrote:> Hi! > > This is what I want.... > > blog | photos | aboutHi, I use this: <%= render(:partial => ''navbar_item'', :collection => @navbar_items, :spacer_template => ''navbar_spacer'') %> With obviously navbar_item displaying an item and the navbar_spacer the spacer. Gr. Raymond -- Raymond Sneekes --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Jul 2, 2007, at 5:07 PM, Jolé wrote:> Hi! > > This is what I want.... > > blog | photos | about > > This is what my code gives me..... > > blog | photos | about | > > The last "|" is to much.... > > [code] > <% for page in @menu_pages %> > <li><%=page%></li> > <li>|</li> > <% end %> > [/code] > > Is there any way I can get some sort of indication whether the array > @menu_pages has a next element? > > -- Jelle<%= @menu_pages.map { |page| content_tag(:li, page.to_s) }.join(content_tag(:li, ''|'')) %> Which should probably be extracted to a helper so you can call: <%= menu_items_for(@menu_pages, ''|'') %> And there will probably be someone who says "you should use do-end for a multi-line block", but I''m believing (and trying to follow) Jim Weirich''s style of using {} when the value of the block is used and do-end otherwise (or when precedence dictates). -Rob Rob Biedenharn http://agileconsultingllc.com Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---