Skip to content

Instantly share code, notes, and snippets.

@drogus
Created April 24, 2012 18:43
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drogus/2482523 to your computer and use it in GitHub Desktop.
Save drogus/2482523 to your computer and use it in GitHub Desktop.
AbstractController

Just run:

bundle index
bundle exec ruby my_controller.rb
<<<
<%= yield %>
>>>
gem "actionpack"
<%= "index view" %>
require 'abstract_controller'
class MyController < AbstractController::Base
include AbstractController::Rendering
include AbstractController::Layouts
include AbstractController::Helpers
append_view_path "."
layout "application"
def index
# my/index with application layout
render
end
def index2
render :inline => "<%= foo %>"
end
private
def foo
"foo helper"
end
helper_method :foo
end
base = MyController.new
base.process(:index)
p base.response_body
base = MyController.new
base.process(:index2)
p base.response_body
<%= "index view" %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment