2013-02-16 52 views
1

所有指定的一类,我越来越想在ERB文件指定一个类时,下面的语法错误:在.erb条款,“语法错误,意想不到的tASSOC,期待tCOLON2”

SyntaxError in Posts#index 

Showing [..]/app/views/posts/_post.html.erb where line #5 raised: 

[..]/app/views/posts/_post.html.erb:5: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.' 
...append= (post.title, :class => 'my-custom-class');@output_... 
...  

        ^
3: <td> 
4:  <div> 
5:  <%= post.title, :class => 'my-custom-class' %> 
6:  </div> 
7: </td> 

我可以将该类添加到<div> - 即<div class='my-custom-class'> .. </div>,但是没有更好的方法,没有div,将类分配嵌入到erb子句中?

想法吗?

回答