I prefer using [1] when there are lots of views that shares the same div#id. When there is another which changes the style, I only add a wrapper. If there should be another div, I use a content_for in the views.
Daniel G. <http://survey.richapplabs.com/index.php?sid=62661&lang=en> 2010/8/16 Edmond Kachale <[email protected]> > Sam, > > 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> >> > > > The second one [2] is ideal in situations where your > layouts/application.html.erb will be used to render different partials with > varied div ids (for whatever reason). Still you can have a "parent div" in > your layout template. > > Regards, > > --- > Edmond > Software Developer | Baobab Health Trust (http://www.baobabhealth.org/) > |Malawi > > Cell: +265 999 465 137 | +265 881 234 717 > Skype: ceekays > > Site: http://sites.google.com/site/ceekaysgroup/ | Blog: > http://edceekays.blogspot.com/ > Facebook: http://www.facebook.com/edceekays | Google profile: > http://www.google.com/profiles/kachaleedmond > > *"A more radical argument for [statistical Natural Language Processing] is > that human cognition is probabilistic and that language must therefore be > probabilistic too since it is an integral part of cognition." -- Chris > Manning (1999)*, *Foundations of Statistical Natural Language Processing*. > > > > Le 16 août 2010 15:23:12 UTC+2, Fernando Perez <[email protected]> a > écrit : > > I prefer [1] as it's less painful to write the views. >> -- >> 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]<rubyonrails-talk%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> >> > -- > 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]<rubyonrails-talk%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > -- 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.

