This is a must, react used to have this on the core but latter they 
extracted it to a 3rd library.

When you have a lot of classes to be conditionally applied the code becomes 
a mess.


I'm not from the core but I believe you can do the code and make the pull 
request, it would be easier to people agree or reject (since this should be 
a simple code).

On Monday, October 24, 2016 at 10:12:25 PM UTC-2, [email protected] wrote:
>
> Heya, 
>
> Setting condition classes is a huge pain in rails at the moment, or maybe 
> i am missing it but i can't see to find it. borrowed from react components 
> kind of style.
>
> I want something like this (the class selected is only added if the value 
> is true)
>
> link_to("Homepage", root_path, class: {selected: selected?})
>
> -> a href class="selected" and other
>
> You can do the same thing to add multiple classes too
>
> link_to("Hello", root_path, class: {class: {btn:true, selected: selected?}}
>
> I think this would be awesome, anything reasons why we shouldn't implement 
> this?
>
> Cheers,
>
> - Emile
>

-- 
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 https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to