Merge branch 'szzh' into develop
This commit is contained in:
commit
c6357181c4
|
@ -0,0 +1,9 @@
|
||||||
|
class Subdomain
|
||||||
|
|
||||||
|
def matches?(request)
|
||||||
|
o = Organization.where(domain: request.subdomain).first
|
||||||
|
request.path_parameters[:id] = o.id if o
|
||||||
|
!o.nil?
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -73,16 +73,9 @@ RedmineApp::Application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
get '/', to: 'organizations#show', constraints:lambda{|request|Organization.where("domain is not null").map(&:domain).include?(request.subdomain)}
|
constraints(Subdomain.new) do
|
||||||
Organization.where("domain is not null").each do |org|
|
get '/', to: 'organizations#show'
|
||||||
# org_domains = []
|
|
||||||
# org_domains << org.domain
|
|
||||||
get '/', to: 'organizations#show', defaults: { id: org.id }, constraints: {subdomain: org.domain}
|
|
||||||
#get '/', to: 'organizations#show', defaults: { id: org.id }, constraints: lambda{ |request| org_domains.include?(request.remote_ip) }
|
|
||||||
end
|
end
|
||||||
get '/', to: 'organizations#show', defaults: { id: 5 }, constraints: {subdomain: 'micros'}
|
|
||||||
get '/', to: 'organizations#show', defaults: { id: 23 }, constraints: {subdomain: 'nubot'}
|
|
||||||
get '/', to: 'organizations#show', defaults: { id: 1 }, constraints: {subdomain: 'team'}
|
|
||||||
|
|
||||||
resources :org_member do
|
resources :org_member do
|
||||||
member do
|
member do
|
||||||
|
|
Loading…
Reference in New Issue