Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 0.70 KB | None | 0 0
  1.   1 class ApplicationController < ActionController::Base
  2.   2  
  3.   3   protect_from_forgery
  4.   4  
  5.   5   def parse_hostname ( hostname )
  6.   6   # takes in the hostname and returns an address that can be sued to define a
  7.   7   # path. used to determine which stylesheet to load based on the hostname
  8.   8     split_string = hostname.split(".")
  9.   9     if split_string.size > 2
  10.  10       if split_string[0] == "store"
  11.  11         path = "store/" + split_string[1]
  12.  12       else
  13.  13         path = "main/" + split_string[1]
  14.  14       end
  15.  15     else
  16.  16       path = "main/" + split_string[0]
  17.  17     end
  18.  18    
  19.  19     return path
  20.  20   end
  21.  21  
  22.  22   helper_method :parse_hostname
  23.  23 end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement