Wrapper Helper Help Please

Judging by similar stuff in rails itself,

   def lhs_block(title, &block)      content = capture(&block)      concat(        content_tag(:div,          content_tag(:div,            content_tag(:div,title,:class=>'PageHeader') +            content_tag(:div,content,:class=>'PageContent'),         :class=>'Page'),       :id=>'LHS'), block.binding)    end

seems to do the trick.


I would like to leave a note: It seems like you are misinterpreting part of the views, models and helpers concept on rails. Please, take this with some salt because I'm kinda new to rails...

You seem to be replacing a lot of div tags that apparently are creating the content header and the content of your website.

I would advise keeping those in a layout, maybe your 'general' layout if it is used in most of your pages. This would be very helpful in case you decide to do some changes in the layout, or a new template.

And if this code is not on most of your pages, then maybe you can use a partial to help.

I usually use helper methods to create html tags that are not related to the template, like, link_to_if_authorized (this is a helper I've written today), and those div's seem to be a big part of your template.

The point is, avoid creating large blocks of html code outside an .rhtml file. This will make the job of putting a layout together a lot easier.

IMO, layouts and views are 90% HTML, Helpers are 10% tops (I currently have 2 of them on ApplicationHelpers and none has HTML code), controllers and models are 0% HTML.

Take this as a light advice, I could have gotten a totally wrong picture.

Best regards,