Created
October 31, 2013 17:06
-
-
Save reedlaw/7253309 to your computer and use it in GitHub Desktop.
Rails application controller with support for interactors
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 ApplicationController < ActionController::Base | |
before_filter :set_default_request | |
def current_account_id | |
@current_account_id ||= current_user.account_repository_id if user_signed_in? | |
end | |
helper_method :current_account_id | |
protected | |
def set_default_request | |
if current_user | |
@request = Request.new(current_user: current_user, | |
current_account_id: current_account_id, | |
params: params) | |
else | |
@request = Request.new(params: params) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment