Components calling components


#1

Hi,

I’m relatively new to ruby and rails. I would like to have a sidebar
component call one of several other constituent components.

I’ve run into some problems, and so I’ve pruned things back to a
relatively simple case.

I have a sidebar component. Renders great. In it’s layout, I call
render_component for another component I would like in the sidebar.
This seems to work. Right now, I end up with an error message in my
sidebar saying that the template is missing. It shows a path to where
it expected to find the template. I agree…that’s where I expected
to put my template.

Here’s the problem: When I put my template in (regardless of content:
empty file, only HTML, etc) and reload I get a bus error and a core
dump.

I’m using WEBrick, Rail 1.0.0, ruby 1.8.4 on FreeBSD 5.4.

Any ideas on what I may be doing wrong?

Thanks,
Brad

Bradley M.


#2

So as I outlined earlier, doing a render_component() call within a
component layout seems to cause WEBrick to core dump for me.

I did some more playing and I found out that instead of doing this:

application.html
- render sidebar component
- render tool1 component
- render tool2 component

if I do this:

application.html
- render tool1 component
- render tool2 component
- render sidebar component
- render tool1 component
- render tool2 component

The page seems to render as I would expect. No core dump.

Now if I revert to the original one, I don’t get a core dump (as long
as it’s within the same WEBrick process).

So, this appears to be some file loading issue, doesn’t it?

How can I go about having the sidebar component ensure that the tool1
and tool2 components are loaded? I tried doing require’s, but that
didn’t seem to work.

Any suggestions?

Thanks,
Brad

Bradley M.