You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pgfqe6ch8/config/initializers/subdomain.rb

29 lines
628 B

6 years ago
class Subdomain
def initialize(opt={})
@opt = {}.merge(opt)
end
def matches?(request)
o = ::Secdomain.where(subname: request.subdomain).first
if(@opt[:sub])
if o && o.sub_type == 2
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