Hi, I’m trying to make it so that an object can be easily printed into
the html format I want. I’ve been focusing on using a case/when control
structure, so let me start by showing you some code… I was trying to
use this following code as a helper method,
def print_question(question)
@question = question
case @question.question_type.code
when ‘free_response’
text_area(@question, :response, :id => “response_” +
question.id.to_s, :cols => 40, :rows => 10)
else
“boo!”
end
end
this is just mock up code, I can’t get this to work. Something about
text_area() needing variables of a certain scope.
I can’t think of a smart way to go about this. It might be nice to just
do @question.print() and have it output the html, but at the same time
I’d like to see if I can’t use the built in form helpers because those
use the routing system.
Another avenue I’ve been exploring is the use of partials, but I don’t
know how to put that into an ERB friendly format.