Skip to content

Instantly share code, notes, and snippets.

@suhanlee
Last active June 6, 2018 05:37
Show Gist options
  • Save suhanlee/53cfb6ccfb8801f862bb98651a933c24 to your computer and use it in GitHub Desktop.
Save suhanlee/53cfb6ccfb8801f862bb98651a933c24 to your computer and use it in GitHub Desktop.
custom mime format
# views/test/index.rb.erb
<%
@test =1
%>
<%= @test %>
# config/initializers/mime_types.rb
Mime::Type.register "text/erb", :rb
# config/routes.rb
Rails.application.routes.draw do
get '/test' => 'test#index'
end
# app/controllers/test_controller.rb
class TestController < ApplicationController
def index
respond_to do |format|
format.rb
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment