class ApplicationController < ActionController::Base protect_from_forgery with: :exception before_action :choose_random_song private def after_sign_out_path_for(resource) new_session_path(resource) end def choose_random_song ids = Scrobble.ids if ids.empty? @random_song = nil else @random_song = Scrobble.find(ids.sample) end end end