Guest User

Untitled

a guest
Jun 23rd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. require 'rubygems'
  2. require 'sinatra'
  3. require 'models/subdomain'
  4.  
  5. get '/' do
  6. if @request.subdomains.length > 0 && (@subdomain = Subdomain.find_by_subdomain(@request.subdomains[0]))
  7. "<script>window.location='#{@subdomain.url}';</script>"
  8. else
  9. erb :index
  10. end
  11. end
  12.  
  13. post '/' do
  14. @subdomain = Subdomain.new(params[:subdomain])
  15. @subdomain.save
  16. erb :index
  17. end
Add Comment
Please, Sign In to add comment