daily pastebin goal
17%
SHARE
TWEET

Untitled

a guest Apr 26th, 2018 241 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private
  2.   def login_as_trial_user
  3.     name = "anonymous_#{session[:session_id]}"
  4.     if User.find_by_username(name)
  5.       UserSession.create(User.find_by_username(name),true)
  6.     else
  7.       guest_role = User.create(:username => name, :password => name, :password_confirmation => name, :role => "guest", :email => "change@this.com")
  8.       UserSession.create(guest_role, true)
  9.     end
  10.     @current_user_session = UserSession.find
  11.     guest_role
  12.   end
  13.  
  14.   def require_login
  15.     login_as_trial_user unless current_user_session
  16.   end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top