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子句中?
想法嗎?