title: Setting class and method variables in the application_controller
body: <p>I'm having real issues in trying to grab the current_user from devise, determine the account id from here and then pass this as a variable to the set_current_tenant_to method from this gem: <a href="https://github.com/ErwinM/acts_as_tenant" rel="nofollow">https://github.com/ErwinM/acts_as_tenant</a>.</p>
  
  <p>In my application controller I have:</p>
  
  <pre><code>class ApplicationController &lt; ActionController::Base
  
    protect_from_forgery # See ActionController::RequestForgeryProtection for details      
    helper :all # include all helpers, all the time
  
    def get_current_account_id
      current_account_user = current_user
      current_account_id = current_account_user.account_id
      current_account_id
    end
  
    current_account = Account.find(get_current_account_id)
    set_current_tenant_to(current_account)
  </code></pre>
  
  <p>I know that the get_current_account_id deduces the correct account_id because when I place it in a before_filter call I can see in the logs it outputs the correct figure. However when I run this I get the following error:</p>
  
  <pre><code>Routing Error
  
  undefined local variable or method `get_current_account_id' for ApplicationController:Class
  </code></pre>
  
  <p>Any advice or pointers on how I can get this to work would be greatly appreciated.</p>