This is not the best way to do it, but will give you some thoughts on pulling the current controller and action.
You can look at https://github.com/weppos/tabs_on_rails for more ideas on how to make it cleaner code. But this requires a bit more setup. You would create a tabs_tag function that would check the current page and do different styling. Personally, I didn't care for this gem too much and prefer to style my pages my own way.
<%= tabs_tag do |tab| %>
<%= tab.home 'Homepage', root_path %>
<%= tab.dashboard 'Dashboard', dashboard_path %>
<%= tab.account 'Account', account_path %>
<% end %>
if "#{controller.controller_name.to_s}.#{controller.action_name.to_s}" == "pages.index"
<li class='active'>
else
<li>
end
or use a helper method
def current_page(page,action)
if controller.controller_name.to_s == page && controller.action_name.to_s == action
'active'
else
'not_active'
end
end
and in your view
<li class="<%= current_page('pages','index') %>">