Guest User

Untitled

a guest
Mar 27th, 2016
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class ApplicationController < ActionController::Base
  2.   # this is sufficient
  3.   def base_url1        
  4.     request.base_url
  5.   end
  6.   # if for some reason you insist on using global variable, than at least use it on subsequent calls to method
  7.   def base_url2        
  8.     $base_url ||= request.base_url
  9.   end
  10. end
Add Comment
Please, Sign In to add comment