Problems with layouts

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

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

What am I doing wrong?

Thank you


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

Are you sure you want to be using ‘render_component’?

_Kevin

On 22 Jun 2006 11:57:53 -0000, Kevin O.
[email protected] 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 :slight_smile: What should I use, though, to display
various elements/actions on the page?

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 :slight_smile:

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 :slight_smile:

Switched to partials. So far so good :slight_smile:

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
[email protected]
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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs