.rhtml in the model rather than the controller

Hi, I’m developing a mini-programming language for research surveys.

question S1 {
	label: The first few questions are just to help us categorize you.
	label: Do you or does any member in your household work for... (MARK 
ONE ONLY FOR EACH.)

	grid {
		col {
			1 Yes
			2 No
		}

		row {
			1 An advertising agency
			2 A public relations company
			3 A marketing research firm or department
			4 An office products company
			5 A manufacturer or retailer of writing instruments
			6 A manufacturer of packaging or adhesives
		}
	}
}

invalid if in("THISQUESTION","1")

I’d like to use .rhtml-style codes for pre-processing macros like this:

<% specialQuestions.each do |q| %>
question <%= q.name %> {
     	label: Where do you purchase writing instruments like <%= q.type 
%> for use at home, school or your office?  (MARK ALL THAT APPLY.)

	multiple {
		1 Office products super stores such as Staples, Office Depot, or 
Office Max.
		2 Office supply catalogs such as Viking, Corporate Express, Boise, 
Staples, Office Depot, or Office Max catalogs
                3 Other
        }
}
<% end %>

(You can see how useful this feature would be for a large survey. One
could build hundreds of similar questions from small chunks of code.)

If the compile phase was in the controller, I could just do:

@script = render_to_string(:inline => @script)

But that doesn’t work if I’m in the model, right? How can I render a
document to a string while in the model?

.rhtml is parsed bu ERb:
http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/index.html

Jules wrote:

.rhtml is parsed bu ERb:
http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/index.html

Genius. This is exactly what I needed. Thank you, Jules!