Created
April 2, 2012 20:53
-
-
Save tenderlove/2287133 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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