Peter Szinek
2006-May-21 19:14 UTC
[Rails] Where to put partials called from the application layout
Hello, My main application layout, app/views/layout/application.rhtml looks like this: something render partial_1 something else render partial_2 something else render partial_3 The partials are not really doing anything, i use them to keep the layout modular (i.e . to have ~30 lines instead of 200). Now, the question is where to put _partial_1.rhtml, _partial_2.rhtml, _partial_3.rhtml. If i am putting them to app/views/layouts, they are not found when a view using this layout (e.g. view of the controller foo) is rendered - but i don''t want to put them into app/views/layouts/foo/ either since if i am going to use the same layout to render the controller bar, i will have to copy them there too, which not DRY. I am quite sure this is a noob question, so what is the standard way to do this? TIA, Peter
Kevin Olbrich
2006-May-21 19:31 UTC
[Rails] Where to put partials called from the application layout
On Sunday, May 21, 2006, at 9:14 PM, Peter Szinek wrote:>Hello, > >My main application layout, app/views/layout/application.rhtml looks >like this: > >something >render partial_1 >something else >render partial_2 >something else >render partial_3 > >The partials are not really doing anything, i use them to keep the >layout modular (i.e . to have ~30 lines instead of 200). Now, the >question is where to put _partial_1.rhtml, _partial_2.rhtml, >_partial_3.rhtml. >If i am putting them to app/views/layouts, they are not found when a >view using this layout (e.g. view of the controller foo) is rendered - >but i don''t want to put them into app/views/layouts/foo/ either since if >i am going to use the same layout to render the controller bar, i will >have to copy them there too, which not DRY. >I am quite sure this is a noob question, so what is the standard way to >do this? > >TIA, >Peter >_______________________________________________ >Rails mailing list >Rails@lists.rubyonrails.org >http://lists.rubyonrails.org/mailman/listinfo/railscreate a directory called ''shared'' in your view path. then call them as ''shared/partial1'' and they should all go to the same place. _Kevin -- Posted with http://DevLists.com. Sign up and save your mailbox.
Peter Szinek
2006-May-21 19:36 UTC
[Rails] Where to put partials called from the application layout
Kevin,> create a directory called ''shared'' in your view path. > > then call them as ''shared/partial1'' and they should all go to the same place.Thx a lot, i have been thinking about this too, just have been wondering what''s the standard way of doing it since something like this (AFAIK) was not discussed in the AWDwR book. So thanks again. Cheers, Peter
Kevin Olbrich
2006-May-21 20:23 UTC
[Rails] Where to put partials called from the application layout
On Sunday, May 21, 2006, at 9:36 PM, Peter Szinek wrote:>Kevin, > >> create a directory called ''shared'' in your view path. >> >> then call them as ''shared/partial1'' and they should all go to the >>same place. > >Thx a lot, i have been thinking about this too, just have been wondering >what''s the standard way of doing it since something like this (AFAIK) >was not discussed in the AWDwR book. So thanks again. > >Cheers, >Peter > >_______________________________________________ >Rails mailing list >Rails@lists.rubyonrails.org >http://lists.rubyonrails.org/mailman/listinfo/railsIf you look carefully, you will see that AWDwR does mention shared partials. _Kevin -- Posted with http://DevLists.com. Sign up and save your mailbox.