Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Rake task to load erb
<%# Put this file in app/views/test.html.erb %>
<h1>Here is some html</h2>
<%= name %>
task :erb_example do
string = Rails.root.join("app/views/test.html.erb").read
name = "Example Name"
result =
#>> "<h1>Here is some html</h2>\n\nhere is name"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.