From: Waldemar Dick Date: 2011-01-28T01:18:07+09:00 Subject: Re: Newbie moving from other language - simple inline Rails conditional Hi, Am 27.01.2011 16:43, schrieb Gennady Bystritsky: > On Jan 25, 2011, at 12:55 PM, Peter D Bethke wrote: [...] >> Basically, I'm trying to say "if the fullpath = x, then output the string "current". I'm sure that the answer is simple. > > The correct syntax for the construct you use is: > > cond ? expr_true : expr_false > > in your case there's no expr_false. So re-wright it to something like: > <%= (request.fullpath == '/home/menu') ? render(:text => 'current') : "" %> > > Or if you really do not need the false expression, you can do something like > <%= render(:text => 'current') if (request.fullpath == '/home/menu') %> Do you need to call 'render' at all, because you are using already an "expression result substitution" (<%=). So actually, you only nead to write: <%= request.fullpath == '/home/menu' ? 'current' : '' %> or <% if request.fullpath == '/home/menu' then %> current <% end %> Waldemar