You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Often you want to apply a particular class or id only if some condition is true, for example in navigation links. In this case you'll have to use the ternary operator like :
…e:resolved]
* define the dynamically defined methods with
'define_method' instead of def
* wrap some string injected method names in quotes
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
I think that we can go with the @parndt suggestion. Since we don't have how to know if the predicate methods will return only true and false this will never work.
Currently Rails helpers only ignore HTML attributes which are nil :
Often you want to apply a particular class or id only if some condition is true, for example in navigation links. In this case you'll have to use the ternary operator like :
In HAML there is a feature where an attribute is also ignored when it equals false, so the line bellow can simply be written :
%span{ class: element.active? && "active" } element
Currently, Rails helpers output the attribute value "false". What do you think of copying the HAML behaviour for all Rails helpers ?
The text was updated successfully, but these errors were encountered: