# Problems with layouts

**URL:** <https://www.ruby-forum.com/t/problems-with-layouts/64143>\
**Category:** Rails\
**Created:** [June 22, 2006, 1:49pm UTC](https://www.ruby-forum.com/t/problems-with-layouts/64143 "2006-06-22T13:49:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dmitrii\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/82dd89/32.png) [@Dmitrii\_D](https://www.ruby-forum.com/u/Dmitrii_D)\
**Post date:** [June 22, 2006, 1:49pm UTC](https://www.ruby-forum.com/t/problems-with-layouts/64143/1 "2006-06-22T13:49:56Z")

</div>

ruby script/generate controller Tools::Search - ok

in views/layouts/application.rhtml:

```
<%= render_component :controller => 'tools/search',
                                    :action => 'searchbox',
                                    :params => {:context =>

```

‘header-section’}  
%\>

in views/tools/search/searchbox.rhtml:

any valid erb/html

In the end I get back a blank page. If I deliberatly induce an error  
in erb in searchbox.rhtml, then that error is displayed along with  
whatever there is in application.rhtml. However, if the template is  
valid, only a blank page is displayed.

What am I doing wrong?

Thank you

---

<div class="post-metadata">

**Author:** ![Dmitrii\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/82dd89/32.png) [@Dmitrii\_D](https://www.ruby-forum.com/u/Dmitrii_D)\
**Post date:** [June 22, 2006, 2:00pm UTC](https://www.ruby-forum.com/t/problems-with-layouts/64143/2 "2006-06-22T14:00:00Z")

</div>

On Thursday, June 22, 2006, at 2:48 PM, Dmitrii D. wrote:

> What am I doing wrong?
> 
> Thank you
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

Are you sure you want to be using ‘render\_component’?

\_Kevin

---

<div class="post-metadata">

**Author:** ![Dmitrii\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/82dd89/32.png) [@Dmitrii\_D](https://www.ruby-forum.com/u/Dmitrii_D)\
**Post date:** [June 22, 2006, 2:09pm UTC](https://www.ruby-forum.com/t/problems-with-layouts/64143/3 "2006-06-22T14:09:39Z")

</div>

On 22 Jun 2006 11:57:53 -0000, Kevin O.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > %\>  
> > valid, only a blank page is displayed.
> > 
> > What am I doing wrong?
> > 
> > Thank you
> 
> Are you sure you want to be using ‘render\_component’?

I’m not sure, actually 🙂 What should I use, though, to display  
various elements/actions on the page?

---

<div class="post-metadata">

**Author:** ![Dmitrii\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/82dd89/32.png) [@Dmitrii\_D](https://www.ruby-forum.com/u/Dmitrii_D)\
**Post date:** [June 22, 2006, 2:29pm UTC](https://www.ruby-forum.com/t/problems-with-layouts/64143/4 "2006-06-22T14:29:09Z")

</div>

> render :partial=\>‘partial’
> 
> I’m also assuming you have a ‘yield’ or ‘content\_for\_layout’ in there  
> somewhere…

Well… It’s not exactly what I want. The header may and will change  
according to variuos parameters. Also other parts of the page will  
look different depending on the context. And since there is only one  
‘yield’ to cover it all, I decided to try ‘render\_component’. I have a  
‘yield’ in application.rhtml though I’m not rendering any actual  
content yet. I’m trying to get a feel of how various page parts could  
be rendered through Rails.

And I would really hate to pollute application.rhtml with a multitude  
of render :partial’s in a ton of if’s and unless’s 🙂

---

<div class="post-metadata">

**Author:** ![Dmitrii\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/82dd89/32.png) [@Dmitrii\_D](https://www.ruby-forum.com/u/Dmitrii_D)\
**Post date:** [June 22, 2006, 6:42pm UTC](https://www.ruby-forum.com/t/problems-with-layouts/64143/5 "2006-06-22T18:42:46Z")

</div>

> > 
> 
> content yet. I’m trying to get a feel of how various page parts could  
> be rendered through Rails.
> 
> And I would really hate to pollute application.rhtml with a multitude  
> of render :partial’s in a ton of if’s and unless’s 🙂

Switched to partials. So far so good 🙂

---

<div class="post-metadata">

**Author:** ![Dmitrii\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/82dd89/32.png) [@Dmitrii\_D](https://www.ruby-forum.com/u/Dmitrii_D)\
**Post date:** [June 22, 2006, 2:13pm UTC](https://www.ruby-forum.com/t/problems-with-layouts/64143/6 "2006-06-22T14:13:21Z")

</div>

On Thursday, June 22, 2006, at 3:07 PM, Dmitrii D. wrote:

> > > ```
> > > :params => {:context =>
> > > 
> > > ```
> > > 
> > > in erb in searchbox.rhtml, then that error is displayed along with  
> > > various elements/actions on the page?
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

Assuming they are just partials, you would probably just use

render :partial=\>‘partial’

I’m also assuming you have a ‘yield’ or ‘content\_for\_layout’ in there  
somewhere…  
\_Kevin
