Hi all, What are your best practices with menu''s in Ruby on Rails? I have now created a helper that sees if a link is the same as the current page an adds a class "active" to it. The only problem is: a link to "users/new" doesn''t work anymore when a guest submits the form and the url becomes: "users/save". How do you guys/girls deal with that? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
You can use link_to_unless_current (http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#M000489) instead of writing your own custom helper that does the same thing. LeonB wrote:> Hi all, > > What are your best practices with menu''s in Ruby on Rails? > > I have now created a helper that sees if a link is the same as the > current page an adds a class "active" to it. > The only problem is: a link to "users/new" doesn''t work anymore when a > guest submits the form and the url becomes: "users/save". > > How do you guys/girls deal with that?-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ah, thanks Mark. Looks like a function I could use. But is that all you use for menu''s? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---