2016-01-14 20:37:56 +08:00
|
|
|
class Subdomain
|
|
|
|
|
2016-02-02 12:40:00 +08:00
|
|
|
def initialize(opt={})
|
|
|
|
@opt = {}.merge(opt)
|
|
|
|
end
|
|
|
|
|
2016-01-14 20:37:56 +08:00
|
|
|
def matches?(request)
|
2016-02-02 12:40:00 +08:00
|
|
|
puts request.path_parameters
|
2016-02-02 17:36:11 +08:00
|
|
|
o = ::Secdomain.where(subname: request.subdomain).first
|
2016-02-02 12:40:00 +08:00
|
|
|
|
|
|
|
if(@opt[:sub])
|
2016-02-23 13:07:42 +08:00
|
|
|
if o && o.sub_type == 2
|
2016-02-02 12:40:00 +08:00
|
|
|
request.path_parameters[:id] = o.pid
|
|
|
|
request.path_parameters[:controller] = 'org_subfields'
|
|
|
|
request.path_parameters[:action] = 'show'
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if o && o.controller
|
|
|
|
request.path_parameters[:id] = o.pid
|
|
|
|
request.path_parameters[:controller] = o.controller
|
|
|
|
request.path_parameters[:action] = o.action
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
false
|
2016-01-14 20:37:56 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|