3 different areas, 1 yield?!


#1

Hello,

I’m having a problem which is following:

[STUFF FROM THE DB]
[STUFF FROM THE DB]
<%= yield %>
[STUFF FROM THE DB]

How can I fill the [STUFF FROM THE DB] div’s when I only have one single
yield? I can’t think of any possible solution…


#2

I’m not sure but guessing these things may change on a per-template
basis. If so content_for may be what you’re looking for:

http://railscasts.com/episodes/8

You could also use a partial to pull this off.

– Josh
http://iammrjoshua.com

Heinz S. wrote:

Hello,

I’m having a problem which is following:

[STUFF FROM THE DB]
[STUFF FROM THE DB]
<%= yield %>
[STUFF FROM THE DB]

How can I fill the [STUFF FROM THE DB] div’s when I only have one single
yield? I can’t think of any possible solution…


#3

Yep! Thanks a lot.


#4

One more question arose that Google and the search couldn’t answer:
One of these div’s have the very same entry no matter what page is being
loaded therefore I’d need have:

<% content_for :footer do %>
<%= render :partial => “shared/footer” %>
<% end %>

in every view and this is not very DRY. Is there any possibility to make
it DRY?


#5

That should go into your layout (apps/views/layouts).


#6

Heinz,

You should really take a look at this:

http://www.railsdev.ws/blog/3/modular-page-assembly-in-rails/

Cheers, Sazima

On Oct 22, 1:35 pm, Heinz S. removed_email_address@domain.invalid