Skip to content

@jnicklas /application_controller.rb secret
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
# This will append the account name to all links and read it out as the account
# name in all tests.
class ApplicationController < ActionController::Base
def default_url_options(options=nil)
if Rails.env.test?
{ :account_name => current_account_name }
else
{}
end
end
def current_account_name
name = request.subdomains.first
name = params[:account_name] if Rails.env.test?
name
end
def current_account
Account.find_by_subdomain(current_account_name)
end
end
@esdras

Thanks man! This gist saved my day.

@sj26

If you actually want to test the subdomains: https://gist.github.com/1939812

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.