Last active
August 29, 2015 14:25
-
-
Save coreyhaines/7e24bf612f59d2dfbbb1 to your computer and use it in GitHub Desktop.
Basic templating - better way?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def render_template template, question: | |
template % { | |
:"question.text" => CGI::escapeHTML(question.display_text.to_s), | |
:"question.name" => CGI::escapeHTML(question.name.to_s), | |
:"question.email" => CGI::escapeHTML(question.email.to_s) | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks to Avdi for reminding me about String#%
https://twitter.com/avdi/status/622516300183683073