I would like to have if if logic:
var == 10 ? "10″ : "Not 10″
in Rails VIEW. I tried the following:
<%= session[:id]=="out"? link_to "Sign in", login_path : link_to "Sign out", logout_path%>
I know this looks weird, and no wonder it doesn't work. So, if I would like to use trernary if condition on VIEW, then what is the correct way to do in my case?
--------- Another condition ---------
I would like to have two "link_to" in else state
----- The error message I received is --------
compile error syntax error, unexpected tSTRING_BEG, expecting kDO or '{' or '(' ...ession[:id]=="out" ? link_to "Sign in",
Leem.fin
source share