Is there any better way to do this?

Gi Ga wrote:

Is there any better way to do this?

<li <%= ('class="current"') if controller.controller_name == 'users' && controller.action_name == 'login' %>>

Here's my take:

<%= content_tag :li, (:class => "current" unless current_page? (:controller => 'users', :action => 'login')) %>

I've not actually tried it though.

Bill

Bill Devaul wrote:

Gi Ga wrote:

Is there any better way to do this?

<li <%= ('class="current"') if controller.controller_name == 'users' && controller.action_name == 'login' %>>

Here's my take:

<%= content_tag :li, (:class => "current" unless current_page? (:controller => 'users', :action => 'login')) %>

I've not actually tried it though.

Bill

Now that I look again, I think the "unless" needs to be "if".

Bill