Rails newbe here:
Using link_to_unless_current and on my website it displays the the menu
item and its entire path in () ...
example:
home (/)
about (/welcome/about)
register (/users/register) ... and so on.
In my application_helper:
# Methods added to this helper will be available to all templates in the
application.
module ApplicationHelper
end
def nav_link(text, controller, action = "index")
link_to_unless_current text , {:controller => controller, :action =>
action}
end
in my views/layout/application.html.erb
<table id="menu">
<tr> <td> <%= nav_link "Home", "welcome" %> </td> </tr>
<tr> <td> <%= nav_link "About", "welcome", "about" %></td>
</tr>
<tr> <td> <%= nav_link "Profile", "welcome", "profile" %>
</td> </tr>
<tr> <td> <%= nav_link "Contact", "welcome", "contact" %>
</td> </tr>
</table>
routes file has:
# You can have the root of your site routed with map.root -- just
remember to delete public/index.html.
map.root :controller => "welcome" ... standard stuff ... right?
so why the path in in the link?
any help would be great. thanks
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.