parent
f3a0e71cee
commit
28035dfc47
@ -1,9 +1,30 @@
|
|||||||
class Subdomain
|
class Subdomain
|
||||||
|
|
||||||
|
def initialize(opt={})
|
||||||
|
@opt = {}.merge(opt)
|
||||||
|
end
|
||||||
|
|
||||||
def matches?(request)
|
def matches?(request)
|
||||||
o = Organization.where(domain: request.subdomain).first
|
puts request.path_parameters
|
||||||
request.path_parameters[:id] = o.id if o
|
o = Secdomain.where(subname: request.subdomain).first
|
||||||
!o.nil?
|
|
||||||
|
if(@opt[:sub])
|
||||||
|
if o && o.sub_type == 2 && request.path_parameters[:sub_dir_name] == 'news'
|
||||||
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
Loading…
Reference in new issue