ruby on rails - Assigning a class in a .erb clause, "syntax error, unexpected tASSOC, expecting tCOLON2" -
ruby on rails - Assigning a class in a .erb clause, "syntax error, unexpected tASSOC, expecting tCOLON2" -
all, i'm getting next syntax error when trying assign class in erb file:
syntaxerror in posts#index showing [..]/app/views/posts/_post.html.erb 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>
i add together class <div>
- namely <div class='my-custom-class'> .. </div>
, there not more elegant way, without div, embedding class assignment in erb clause?
ideas here?
<%= content_tag, :div, post.title, :class => 'my-custom-class' %>
http://api.rubyonrails.org/classes/actionview/helpers/taghelper.html#method-i-content_tag
ruby-on-rails
Comments
Post a Comment