nobosh
2010-Sep-26 02:36 UTC
[Rails] Rails 3 - Loading a Subnav with Ajax… Which 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... -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2010-Sep-26 07:59 UTC
Re: [Rails] Rails 3 - Loading a Subnav with Ajax… Which controller owns a subnav?
On 26 September 2010 03:36, nobosh <bhellman1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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...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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
radhames brito
2010-Sep-27 04:21 UTC
Re: [Rails] Rails 3 - Loading a Subnav with Ajax… Which controller owns a subnav?
check the simple navigations plugin http://blog.andischacke.com/2009/10/simple-navigation-gemplugin-version-2.html -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Maybe Matching Threads
- sub-selection with $
- template.expect_render fails when partial is rendered from a helper
- Working in install acts_as_commentable, On create, error: "unknown attribute: book_id"
- Rails Commenting, Plugins?
- HowTo; Rails 3, having Tabs that load content via jQuery ... No Page Refesh