Hi, I was trying to include a view inside my application.rhtml layout, and I found that render_component seemed to be the answer. Unfortunately, it doesn''t understand the ":layout => false" option (like a normal render), and also doesn''t seem to be able to render partials at all. So is there a way to do what I''m trying? short of using a custom layout on this "component" and deleting the default one? I also tried using "render" directly inside the layout, but it doesn''t output anything at all. Thanks in advance! Ivan V.
If you have a partial in say, ''app/views/users/_form.rhtml'' and you want to render this from anywhere in your app you could use: render :partial=>"/users/form" This will hopefully give you what you want. And since its a partial, you don''t need to use layout=>false. The render_components method is for rendering controllers/views from the components directory and is quite different. Hope this helps! -Nick On 11/22/05, Iván Vega Rivera <ivanvega-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi, > > I was trying to include a view inside my application.rhtml layout, and I > found that render_component seemed to be the answer. Unfortunately, it > doesn''t understand the ":layout => false" option (like a normal render), > and also doesn''t seem to be able to render partials at all. > > So is there a way to do what I''m trying? short of using a custom layout > on this "component" and deleting the default one? > > I also tried using "render" directly inside the layout, but it doesn''t > output anything at all. > > Thanks in advance! > > Ivan V. > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
I should have guessed it would be so simple... Thanks a lot! Ivan V. Nick Stuart wrote:> If you have a partial in say, ''app/views/users/_form.rhtml'' and you > want to render this from anywhere in your app you could use: > render :partial=>"/users/form" > This will hopefully give you what you want. And since its a partial, > you don''t need to use layout=>false. The render_components method is > for rendering controllers/views from the components directory and is > quite different. > > Hope this helps! > -Nick > > On 11/22/05, *Iván Vega Rivera* <ivanvega-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > <mailto:ivanvega-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> wrote: > > Hi, > > I was trying to include a view inside my application.rhtml layout, > and I > found that render_component seemed to be the answer. Unfortunately, it > doesn''t understand the ":layout => false" option (like a normal > render), > and also doesn''t seem to be able to render partials at all. > > So is there a way to do what I''m trying? short of using a custom > layout > on this "component" and deleting the default one? > > I also tried using "render" directly inside the layout, but it > doesn''t > output anything at all. > > Thanks in advance! > > Ivan V. > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org <mailto:Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org> > http://lists.rubyonrails.org/mailman/listinfo/rails > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
No problem. I still find myself trying to make things to complicated as well. :) On 11/23/05, Iván Vega Rivera <ivanvega-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I should have guessed it would be so simple... Thanks a lot! > > Ivan V._______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails