2013-04-28 52 views
2

我是编码的初学者。 我正在接受具体的教训,但有些措施对我无效。 技术上它应该显示页面上方的“home”,“about”导航链接,但它对我不起作用。ruby​​ on rails导航菜单链接错误,使用“%link_to”

这里就是这样说的:(这是一个home.html.erb文件)

<% link_to "Home", root_path %>

<% link_to "About", about_path %>

<h1>Welcome to one month rails!</h1>

<p>you've found the home page for the <%= link_to "one month rails", "http://onemonthrails.com" %> application. </p>

是否有任何人谁可以帮我?

预先感谢您

P.S:我使用这些Windows 7操作系统。

回答

1

你错过了一些等号:

<%= link_to "Home", root_path %> 
<%= link_to "About", about_path %> 

<%<%=是不同的:对于细节

<% Ruby code -- inline with output %> 
<%= Ruby expression -- replace with result %> 

检查ERB Documentation

+0

非常感谢。它的工作 – bulgarim 2013-04-28 07:21:33