-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
spike: capture and redirect accordingly
- Loading branch information
1 parent
e0e0388
commit c1dfc0f
Showing
3 changed files
with
19 additions
and
34 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
class ContentController < ApplicationController | ||
before_action :track_ahoy_visit, raise: false | ||
before_action :track_ahoy_visit, :process_subdomain_smart_link_redirect, raise: false | ||
|
||
private | ||
|
||
def process_subdomain_smart_link_redirect | ||
subdomain = request.subdomain | ||
url_parameters = request.path | ||
if !subdomain.blank? | ||
unless Subdomain.all.pluck(:name).any?{|name| subdomain == name} | ||
# process S2 link - append parameters for 2nd redirect | ||
return redirect_to "#{root_url(subdomain: Subdomain.current.name)}?s2_redirect_to=#{subdomain}&s2_query=#{subdomain}&s2_url_params=#{url_parameters}&s2_subdomain=#{subdomain}" | ||
end | ||
end | ||
end | ||
end |