If you really need it just override the link_to and add this syntax you 
want to use

def link_to
   class_attr = deal_with_classes_the_way_i_want
   super(stuff, class: class_attr)
end

On Wednesday, 5 March 2014 12:36:32 UTC-3, Stefan Schüßler wrote:
>
> When dealing with conditional class attribute values in HTML tags, I often 
> find myself writing code like:
>
>   link_to(post.title, post, class: "post #{post.active? ? "active" : ""}")
>
> The code would be much cleaner if we allowed a hash syntax:
>
>   link_to(post.title, post, class: {"post" => true, "active" => 
> post.active?})
>
> The implementation is straightforward:
>
>   
> https://github.com/sos4nt/rails/commit/a9ed04f75ce9db46af6cbdefa64dfb09fb3eb73a
>
> What do you think?
>
> -Stefan
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to