Sam Kong wrote:
> Hi,
> 
> I wonder which is better between [1] and [2].
> 
> [1]
> ------layouts/application.html.erb--------
> ...
> <div id="content">
>   <%= yield %>
> </div>
> ...
> 
> -------some_action.html.erb--------
> ...
> <h1>Page title</h1>
> <p>Some contents...</p>
> ...
> 
> [2]
> ------layouts/application.html.erb--------
> ...
> <%= yield %>
> ...
> 
> -------some_action.html.erb--------
> <div id="content">
> ...
> <h1>Page title</h1>
> <p>Some contents...</p>
> ...
> </div>
> 
> 
> Practically they are same.
> I think [1] is more DRY.
> But I feel kinda weird with [1] because the wrapper div is separated
> from the real content.

Option 1 is better.  The wrapper div, if it's constant, *should* be 
separated from the content -- it's not a part of the content any more 
than a static header or footer would be.

(BTW, I highly recommend Haml instead of ERb.)

> 
> Which do you think is better?
> 
> Sam

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to