Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Tabs on Rails is a simple Rails plugin for creating and managing tabs and navigation menus.
Failed to load latest commit information.
gemfiles Install Appraisal
lib Release 2.2.0
test Rename option :current to :active_class (GH-23)
.gemtest Add support for rubygems-test.
.gitignore Ignore the .rvmrc file
.travis.yml Setup Travis
Appraisals Install Appraisal Release 2.2.0
Gemfile Use gemspec in Gemfile to sync Gemfile with Rakefile
LICENSE.txt Add extension to the license file Update copyright
Rakefile Remove mocha fixed version
init.rb There should be a better way to do this!

Tabs on Rails

TabsOnRails is a simple Rails plugin for creating tabs and navigation menus. It provides helpers for generating navigation menus with a flexible interface.


  • Rails 3

Please note

  • TabsOnRails 2.x requires Rails 3. Use TabsOnRails 1.3.x with Rails 2.
  • TabsOnRails doesn't work with Rails 2.1 or lower (comment and commit).


RubyGems is the preferred way to install TabsOnRails and the best way if you want install a stable version.

$ gem install tabs_on_rails

Specify the Gem dependency in the Bundler Gemfile.

gem "tabs_on_rails"

Use Bundler and the :git option if you want to grab the latest version from the Git repository.


In your template use the tabs_tag helper to create your tab.

<%= tabs_tag do |tab| %>
  <%= tab.home      'Homepage', root_path %>
  <%= tab.dashboard 'Dashboard', dashboard_path %>
  <%= tab.account   'Account', account_path %>
<% end %>

The example above produces the following HTML output.

  <li><a href="/">Homepage</a></li>
  <li><a href="/dashboard">Dashboard</a></li>
  <li><a href="/account">Account</a></li>

The usage is similar to the Rails route file. You create named tabs with the syntax tab.name_of_tab. The name you use creating a tab is the same you're going to refer to in your controller when you want to mark a tab as the current tab.

Now, if the action belongs to DashboardController, the template will automatically render the following HTML code.

  <li><a href="/">Homepage</a></li>
  <li class="custom"><span>Dashboard</span></li>
  <li><a href="/account">Account</a></li>

Use the current_tab helper method if you need to access the value of current tab in your controller or template.

class DashboardController < ApplicationController
  set_tab :dashboard

# In your view
<p>The name of current tab is <%= current_tab %>.</p>

Read the documentation to learn more about advanced usage, builders and namespaces.



Copyright (c) 2009-2013 Simone Carletti. This is Free Software distributed under the MIT license.

Something went wrong with that request. Please try again.