# Tabbed Navigation

**URL:** <https://www.ruby-forum.com/t/tabbed-navigation/112740>\
**Category:** Rails\
**Created:** [August 22, 2007, 7:53pm UTC](https://www.ruby-forum.com/t/tabbed-navigation/112740 "2007-08-22T19:53:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cidol](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/54ee81/32.png) [@cidol](https://www.ruby-forum.com/u/cidol)\
**Post date:** [August 22, 2007, 7:53pm UTC](https://www.ruby-forum.com/t/tabbed-navigation/112740/1 "2007-08-22T19:53:59Z")

</div>

Went back and forth a bit trying to find out the easiest way to do this.  
Found a plugin but it didn’t seem very stable/well written.

This is what I have going right now:

- if @content\_for\_recipe\_editor\_tabs  
= yield :recipe\_editor\_tabs
- else  
= tabbed\_navigator(RecipesController.send “edit\_tabs”)

If any templates/sub-templates/partials used in this render have  
something  
like this:

- content\_for(‘recipe\_editor\_tabs’ ) do  
= tabbed\_navigator(RecipesController.send “new\_tabs”)

That content will be used in place of the content specified in the else  
block.

Here’s what new\_tabs and edit\_tabs looks like.

def self.new\_tabs  
[tab(“Description”, :new\_ingredient\_path, :needs =\> [:recipe])]  
end

This will likely abstract a little more as we add more views that need  
tabbed\_navigators, but I’ll hold off on that to see where the repetition  
crops up.

‘tabbed\_navigator’ helper takes the array of tabs and renders them as an  
ul  
with links. Highlighting rules are currently done with a current\_page?  
call.

tab(name, url\_for\_method, options) Returns a Hash with greater verbosity  
and  
possible defaults.

* * *

Right now this looks like the simplest way to do things. I looked a bit  
at:

[http://blog.seesaw.it/articles/2006/07/23/the-easiest-way-to-add-tabbed-navigation-to-your-rails-app](http://blog.seesaw.it/articles/2006/07/23/the-easiest-way-to-add-tabbed-navigation-to-your-rails-app)

And had some trouble installing it and using it.

Does anybody know of any other easy solutions to this issue?

---

<div class="post-metadata">

**Author:** ![cidol](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/54ee81/32.png) [@cidol](https://www.ruby-forum.com/u/cidol)\
**Post date:** [August 22, 2007, 8:16pm UTC](https://www.ruby-forum.com/t/tabbed-navigation/112740/2 "2007-08-22T20:16:04Z")

</div>

What was the problem with the seesaw plugin? I was able to make it  
work pretty much right away. (I know that’s not much help …)
