programming the dom in rails

hi

i'm pretty new to rails, so excuse me.

Is there a way to programmatically build the DOM tree in Rails? This seems a pretty fundamental feature to have ..

eg, generating the view for a calendar. There's a clear pattern of table/css elements, half-in-step with a bunch of data that's going to appear on the calendar.

It would be clean to have two separate loops for these in code, one for the html stuff, one for the content. -- or is there another way to keep these concerns separate?

or perhaps there is a clever (not ridic) design solution?

thanks, Darren

darren wrote:

hi

i'm pretty new to rails, so excuse me.

Is there a way to programmatically build the DOM tree in Rails? This seems a pretty fundamental feature to have ..

eg, generating the view for a calendar. There's a clear pattern of table/css elements, half-in-step with a bunch of data that's going to appear on the calendar.

It would be clean to have two separate loops for these in code, one for the html stuff, one for the content. -- or is there another way to keep these concerns separate?

or perhaps there is a clever (not ridic) design solution?

The usual way is the script.aculo.us builder module:

though sometimes a good way is to render a display:none HTML template in the page, make clones of that, and loop through replacing dummy text nodes with real data.

Thanks for the feedback Mark.

I don't think scriptaculous' Builder is what I'm after as it's JavaScript, but it seems the Rails/Rubyforge Builder is the server- side equivalent that I'm after.

Cheers, Darren

perhaps they're actually related .. i didn't actually think to check

:slight_smile: