Skip to content

Instantly share code, notes, and snippets.

@tenderlove
Created April 2, 2012 20:53
Show Gist options
  • Save tenderlove/2287133 to your computer and use it in GitHub Desktop.
Save tenderlove/2287133 to your computer and use it in GitHub Desktop.
class MessagesController < ApplicationController
class IndexContext
# Cargo cult this include
include ActionView::Context
def initialize controller, person
@person = person
@controller = controller
_prepare_context
end
def messages
Message.for(@person)
end
def lookup_context
@controller.lookup_context
end
end
def index
return redirect_to '/' unless session.person?
@view_context = IndexContext.new(self, session.person)
end
private
def view_context
@view_context || super
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment