app/controllers/application_controller.rb
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
Prevent CSRF attacks by raising an exception.
For APIs, you may want to use :null_session instead.
Prevent CSRF attacks by raising an exception . For APIs you may want to use : null_session instead .
def current_user
    return unless session[:user_id]
    current_user ||= User.includes(:brands).find(session[:user_id])
    session[:user] = current_user
    if current_user.studio_id.present?
      @current_user = User.includes(:brands).find(current_user.studio_id)
    else
      @current_user = User.includes(:brands).find(session[:user_id])
    end
  end
def current_user return unless session [ :user_id ] current_user ||= User . includes ( :brands ) . find ( session [ :user_id ] ) session [ :user ] = current_user if current_user . studio_id . present? @current_user = User . includes ( :brands ) . find ( current_user . studio_id ) else @current_user = User . includes ( :brands ) . find ( session [ :user_id ] ) end end
Prevent CSRF attacks by raising an exception.
Prevent CSRF attacks by raising an exception .