Skip to content

Instantly share code, notes, and snippets.

@reedlaw
Created October 31, 2013 17:06
Show Gist options
  • Save reedlaw/7253309 to your computer and use it in GitHub Desktop.
Save reedlaw/7253309 to your computer and use it in GitHub Desktop.
Rails application controller with support for interactors
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