Method: ActionController::Base#set_permanent_vbulletin_session_for

Defined in:
lib/vbulletin_rails/core_ext.rb

- (Object) set_permanent_vbulletin_session_for(vb_user) (private)

If your application uses "Remember me" variation, this method takes care for VBulletin and sets remember me cookie as well. It takes VBulletinRails::User instance as parameter. It also sets session[:vbulletin_permanent] to true which can be checked in your application if needed.

To use it, a config.vbulletin.cookie_salt must be set. See: Rails::Application::Configuration vbulletin options

class SessionsController < ApplicationController
  def create
    vb_user = VBulletinRails::User.find_by_email('user@example.com')
    set_permanent_vbulletin_session_for vb_user
  end
end


193
194
195
196
197
# File 'lib/vbulletin_rails/core_ext.rb', line 193

def set_permanent_vbulletin_session_for vb_user
  cookies.permanent[:bb_userid] = vb_user.userid
  cookies.permanent[:bb_password] = vb_user.bb_password
  session[:vbulletin_permanent] = true
end

Comments