为什么这行代码会引发语法错误?

时间:2011-05-03 04:23:09

标签: ruby-on-rails ruby ruby-on-rails-3

我在html.erb文件中有这一行:

<p> Share your unique link with as many people as you can. <b>The more people you refer, the sooner you will be invited to DreamStill.</b> Also, about every two weeks, <b>artists that have referred the greatest number of users will be featured in an email sent out to all DreamStill members!</b> To check up on how many users you have referred, simply enter your same email address (the one you used to sign up) into the signup form at <%= link to "the signup page.", "www.dreamstill.com" %></p>

这是错误:

compile error
/app/app/views/user_mailer/email.html.erb:7: syntax error, unexpected '<'
<p> Share your unique link with...
 ^
/app/app/views/user_mailer/email.html.erb:7: syntax error, unexpected tIDENTIFIER, expecting kDO or '{' or '('

3 个答案:

答案 0 :(得分:5)

link to应为link_to

答案 1 :(得分:0)

使用此<%= link_to "the signup page.", "www.dreamstill.com" %>

答案 2 :(得分:0)

<p> Share your unique link with as many people as you can. 
<b>The more people you refer, the sooner you will be invited to DreamStill.</b> 
**Also, about every two weeks, <b>artists that have referred the greatest number of users will be featured in an email sent out to all DreamStill members!</b>** 
To check up on how many users you have referred, simply enter your same email address (the one you used to sign up) into the signup form at <%= link to "the signup page.", "www.dreamstill.com" %>
</p>

第3行没有开放标记