Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'rubygems'
- require 'sinatra'
- require 'models/subdomain'
- get '/' do
- if @request.subdomains.length > 0 && (@subdomain = Subdomain.find_by_subdomain(@request.subdomains[0]))
- "<script>window.location='#{@subdomain.url}';</script>"
- else
- erb :index
- end
- end
- post '/' do
- @subdomain = Subdomain.new(params[:subdomain])
- @subdomain.save
- erb :index
- end
Add Comment
Please, Sign In to add comment