KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to add a class to a link_to only if a statement is true. <%= link_to product.name, product, :class => "last" if product == @products.last %> The problem that the IF statement affects the whole line and not just the :class part. I know i can get it done with IF ELSE, but is it possible to do it in 1 line ?
Tags (comma-separated)
Save Edits
Cancel