Rails 3 - Loading a Subnav with Ajax… Whic h controller owns a subnav?

Once my Rails 3 app is loaded, a user can click an item which needs to
then load a dynamic subnav.

My thinking is (since it needs to be dynamic) is onClick to make a
jQuery AJAX call to the server and then to inject the HTML response
into a DIV on the page…

What I’d like your advice on is how/where the subnav logic should live
in the rails app, as I don’t have a navigation controller or view…
But maybe I should have one?

Do I create a navigation controller? Or use the application
controller? I also have a pages controller that I use for the landing
page, about, contact, etc…

On 26 September 2010 03:36, nobosh [email protected] wrote:

Do I create a navigation controller? Or use the application
controller? I also have a pages controller that I use for the landing
page, about, contact, etc…

I don’t think there is a ‘correct’ answer to this, it depends entirely
on your specific application. Generally if you put something in what
seems intuitively to you to be the right place you will not go far
wrong. Also make sure you write good automated tests so you can
easily re-factor when you realise you did not get it right the first
time, so you can move stuff about secure in the knowledge that you
have probably not broken anything.

Colin

check the simple navigations plugin

http://blog.andischacke.com/2009/10/simple-navigation-gemplugin-version-2.html

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs