Skip to content

Commit 1e67b32

Browse files
committed
this should work
1 parent f0a4f79 commit 1e67b32

4 files changed

Lines changed: 6 additions & 4 deletions

File tree

app/controllers/i/posts_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ def index
55
logger.debug request.host
66
logger.debug "---------"
77
logger.debug "---------"
8+
89
redirect_to google_drive_authorize_path if current_user && current_user.google_auth_token.nil?
10+
911
@user = User.find_by(username: host_or_param)
1012
return redirect_to root_path unless @user
1113

app/models/user.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
class User < ApplicationRecord
22
DOMAIN_MAPPING = {
3-
"patwalls.co" => "patwalls"
3+
"patwalls.co" => "patwalls",
4+
"leeronisrael.com" => "leeronisrael"
45
}
56
# Include default devise modules. Others available are:
67
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable

app/services/subdomain.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ def initialize
44
end
55

66
def matches?(request)
7-
byebug
87
if request.subdomain.present? && request.subdomain != 'www'
98
@users.find(request.subdomain)
109
end

config/routes.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
Rails.application.routes.draw do
22
devise_for :users
33

4-
constraints(subdomain: 'patwalls') do
4+
constraints(subdomain: ['patwalls', 'leeronisrael']) do
55
root "i/posts#index", as: 'subdomain_blog_index'
66
get '/:post_id', to: 'i/posts#show', as: 'subdomain_blog_show'
77
end
88

9-
constraints(host: 'patwalls.co') do
9+
constraints(host: ['patwalls.co', 'leeronisrael.com']) do
1010
root "i/posts#index", as: 'host_blog_index'
1111
get '/:post_id', to: 'i/posts#show', as: 'host_blog_show'
1212
end

0 commit comments

Comments
 (0)