I am trying to extract a subdomain in the application controller, for widespread use of the application, thus
@subdomain = request.subdomains(0)
While this code works on any other controller, in the application controller it gives
undefined local variable or method `request' for ApplicationController:Class
an exception.
I am using rails 3.2.2 on Lion.
I took it from a DHH code snippet for basecamp style subdomains -
class ApplicationController < ActionController::Base before_filter :set_current_account private def set_current_account @current_account = Account.find_by_subdomain!(request.subdomains.first) end end
What am I missing?
source share