<commit_before>Sisyphus::Application.routes.draw do

  ## FormatTest class is used to restrict requests to certain formats. We need 
  ## this with ember because if the user hits '/projects' they will get JSON, 
  ## which we don't want. We want them to load the ember app and ember will 
  ## get the JSON. 
  class FormatTest
    attr_accessor :mime_type

    def initialize(format)
      @mime_type = Mime::Type.lookup_by_extension(format)
    end

    def matches?(request)
      request.format == mime_type
    end
  end

  ## Routes
  ##########

  ## Rails Admin Routes
  # devise_for :super_admins
  mount RailsAdmin::Engine => '/admin', :as => 'rails_admin'

  devise_for :users, controllers: { sessions: 'sessions',
                                    omniauth_callbacks: 'omniauth_callbacks' }
  devise_for :students, skip: ['sessions', 'omniauth_callbacks' ]
  devise_for :teachers, skip: ['sessions', 'omniauth_callbacks' ]

  resources :projects, :constraints => FormatTest.new(:json)
  resources :courses, :constraints => FormatTest.new(:json)
  resources :project_groups, :constraints => FormatTest.new(:json)
  resources :subtasks, :constraints => FormatTest.new(:json)
  resources :students, :constraints => FormatTest.new(:json)
  resources :comments, :constraints => FormatTest.new(:json)
  resources :semesters,:constraints => FormatTest.new(:json)

  resources :project_groups, :constraints => FormatTest.new(:json) do
    resources :history_trackers, only: [:index, :show]
  end

  get '/users/:id', to: 'users#show'
  root :to => "ember#index", as: :ember_root, :constraints => FormatTest.new(:html)

  ## Catch all Route which will just render ember, and ember can figure out the route
  get '*path' => 'ember#index', :constraints => FormatTest.new(:html)
end<commit_msg>Fixes issue with users/login => users_controller#show<commit_after>Sisyphus::Application.routes.draw do

  ## FormatTest class is used to restrict requests to certain formats. We need 
  ## this with ember because if the user hits '/projects' they will get JSON, 
  ## which we don't want. We want them to load the ember app and ember will 
  ## get the JSON. 
  class FormatTest
    attr_accessor :mime_type

    def initialize(format)
      @mime_type = Mime::Type.lookup_by_extension(format)
    end

    def matches?(request)
      request.format == mime_type
    end
  end

  ## Routes
  ##########

  ## Rails Admin Routes
  # devise_for :super_admins
  mount RailsAdmin::Engine => '/admin', :as => 'rails_admin'

  devise_for :users, controllers: { sessions: 'sessions',
                                    omniauth_callbacks: 'omniauth_callbacks' }
  devise_for :students, skip: ['sessions', 'omniauth_callbacks' ]
  devise_for :teachers, skip: ['sessions', 'omniauth_callbacks' ]

  resources :projects, :constraints => FormatTest.new(:json)
  resources :courses, :constraints => FormatTest.new(:json)
  resources :project_groups, :constraints => FormatTest.new(:json)
  resources :subtasks, :constraints => FormatTest.new(:json)
  resources :students, :constraints => FormatTest.new(:json)
  resources :comments, :constraints => FormatTest.new(:json)
  resources :semesters,:constraints => FormatTest.new(:json)

  resources :project_groups, :constraints => FormatTest.new(:json) do
    resources :history_trackers, only: [:index, :show]
  end

  get '/users/:id', to: 'users#show', :constraints => FormatTest.new(:json)
  root :to => "ember#index", as: :ember_root, :constraints => FormatTest.new(:html)

  ## Catch all Route which will just render ember, and ember can figure out the route
  get '*path' => 'ember#index', :constraints => FormatTest.new(:html)
end
{'fraction_non_alphanumeric': 0.1263960773631163, 'fraction_numerical': 0.0, 'mean_word_length': 4.208510638297873, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1497303', 'n_tokens_mistral': 1164, 'n_tokens_neox': 1107, 'n_words': 321}