-
-
Save jnicklas/643a758320a2926bd2ed to your computer and use it in GitHub Desktop.
This file contains 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
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks man! This gist saved my day.