Hi, I have 3 controller/model''s (Books, Chapters, Sections) and would like to combine the views into one (list of the books, chapters, sections). Is this possible? Would I be able to use partials even if they have different controllers, or do I have to combine all into a single controller? Any help, tips, advice is appreciated. I am still a beginner. DC -- Posted via http://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 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.
Dave Castellano wrote in post #968637:> Hi, > > I have 3 controller/model''s (Books, Chapters, Sections)What''s a controller/model? Controllers and models are separate things, and need not come in pairs.> and would like > to combine the views into one (list of the books, chapters, sections). > Is this possible?Depends on the nature of the views.> Would I be able to use partials even if they have > different controllers, or do I have to combine all into a single > controller?You can use partials from anywhere. app/views/shared is the usual place to put partials that are used with multiple controllers.> Any help, tips, advice is appreciated. I am still a > beginner. > > DCBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://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 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.
On 15 December 2010 17:49, Dave Castellano <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi, > > I have 3 controller/model''s (Books, Chapters, Sections) and would like > to combine the views into one (list of the books, chapters, sections). > Is this possible? Would I be able to use partials even if they have > different controllers, or do I have to combine all into a single > controller? Any help, tips, advice is appreciated. I am still a > beginner.Just assemble the data you need for the partials in whatever controller you deem appropriate, and in the view render the appropriate partials passing them the data they need. Don''t forget that if you have a book object @book then its chapters will be @book.chapters and for each chapter the sections will be chapter.sections (assuming you have set the associations up appropriately, and assuming I am interpreting your problem correctly. 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law wrote in post #968709:> On 15 December 2010 17:49, Dave Castellano <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> Hi, >> >> I have 3 controller/model''s (Books, Chapters, Sections) and would like >> to combine the views into one (list of the books, chapters, sections). >> Is this possible? Would I be able to use partials even if they have >> different controllers, or do I have to combine all into a single >> controller? Any help, tips, advice is appreciated. I am still a >> beginner. > > Just assemble the data you need for the partials in whatever > controller you deem appropriate, and in the view render the > appropriate partials passing them the data they need. Don''t forget > that if you have a book object @book then its chapters will be > @book.chapters and for each chapter the sections will be > chapter.sections (assuming you have set the associations up > appropriately, and assuming I am interpreting your problem correctly. > > ColinThanks for your helpful reply. Dave -- Posted via http://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 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.