我正在关注RoR tutorial并且我正在按照指示完成(或者我认为)。
这是我的app / views / static_pages / home.html.erb文件:
<% provide(:title, 'Home') %>
<h1>Sample App</h1>
<p>
This is the home page for the
<a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
sample application.
</p>
<%= link_to "Sign up now!", '#', class: "signup_button round" %>
但是,当我在本地主机中运行它时,我收到错误:
sample_app / app / views / static_pages / home.html.erb:9:语法错误,意外':' ...“立即注册!”,“#”,类:“signup_button round”); @ outp ...
我不明白我要改变什么以及为什么。有什么帮助吗?
答案 0 :(得分:3)
Ruby 1.9允许
{foo: "bar"}
作为
的替代方案{:foo => "bar"}
它看起来你在本地运行ruby 1.8,因此出错了。我建议升级到ruby 1.9。 Ruby 1.8即将推出。
答案 1 :(得分:-1)
我想我找到了它。
如果您正在运行较新版本的rails
应该叫做
<%= link_to "Sign up now!", '#', :class => "signup_button round" %>
而不是你在那里