NavBar is a reference table whose content needs to be accessed in all VIEWS. This includes the application layout too. Can you please guide which is the best way to model this??? + where to initialize an instance?
On Jun 16, 7:43 am, Ritvvij <[email protected]> wrote: > Well.. I am using it in application.html.erb --> layouts. > So where should I create the instance? > > On Jun 16, 6:43 am, Ar Chron <[email protected]> wrote: > > > In the controller for the action you are testing, did you create an > > instance of your Navbar class? You are defining a Navbar class, but a > > class without an instance is fairly useless... Something like: > > > @navbar = Navbar.new > > > If so, then the view code as you had it: > > > <%= @navbar.all_modules %> > > > should have an instance of Navbar to work with. Your all_modules method > > inside Navbar cons a little dubious though... > > -- > > Posted viahttp://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

