Last active
August 29, 2015 13:57
-
-
Save hubertlepicki/9564569 to your computer and use it in GitHub Desktop.
The @app Object
This file contains 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 ApplicationController < ActionController::Base | |
... | |
def intranet | |
@intranet ||= Intranet.for_employee(current_user) | |
end | |
helper_method :intranet | |
end |
This file contains 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 Intranet | |
... | |
def files(manager_source = FileManager.method(:new), | |
browser_source = FileBrowser.method(:new)) | |
@files ||= if admin? | |
manager_source.call | |
else | |
browser_source.call | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment