app/controllers/application_controller.rb
# almost everything we do is restricted to a department so we always load_department
# feel free to skip_before_filter when desired
almost everything we do is restricted to a department so we always load_department
feel free to skip_before_filter when desired
almost everything we do is restricted to a department so we always load_department feel free to skip_before_filter when desired
def department_chooser
    if (params[:su_mode] && current_user.superuser?)
      current_user.update_attribute(:supermode, params[:su_mode]=='ON')
      flash[:notice] = "Supermode is now #{current_user.supermode? ? 'ON' : 'OFF'}"
      redirect_to :back
    elsif (params["chooser"] && params["chooser"]["dept_id"])
      session[:department_id] = params["chooser"]["dept_id"]
      redirect_to switch_department_path
    end
  end
def department_chooser if ( params [ :su_mode ] && current_user . superuser? ) current_user . update_attribute ( :supermode , params [ :su_mode ] == 'ON' ) flash [ :notice ] = "Supermode is now #{current_user.supermode? ? 'ON' : 'OFF'}" redirect_to :back elsif ( params [ "chooser" ] && params [ "chooser" ] [ "dept_id" ] ) session [ :department_id ] = params [ "chooser" ] [ "dept_id" ] redirect_to switch_department_path end end
almost everything we do is restricted to a department so we always load_department
feel free to skip_before_filter when desired
almost everything we do is restricted to a department so we always load_department feel free to skip_before_filter when desired