ruby menu
Ruby
code posted
by
casen
created at 02 Sep 03:18, updated at 19 Oct 19:40
Edit
|
Back
1 2 3 4 5 6 7 8 9 10 11 12 |
module ApplicationHelper def nav_links items = [] items << {:name =>'Home', :url => root_url} items << {:name =>'Login', :url => login_path} items << {:name =>'Register', :url => new_user_path} items.each do |item| current = (current_page? item[:url]) ? "current" : nil yield(current, link_to(item[:name], item[:url])) end end end |
386 Bytes in 2 ms with coderay