summary refs log tree commit diff stats
path: root/rails/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'rails/app/controllers')
-rw-r--r--rails/app/controllers/concerns/.keep0
-rw-r--r--rails/app/controllers/lingo/application_controller.rb5
-rw-r--r--rails/app/controllers/lingo/scores_controller.rb25
3 files changed, 0 insertions, 30 deletions
diff --git a/rails/app/controllers/concerns/.keep b/rails/app/controllers/concerns/.keep deleted file mode 100644 index e69de29..0000000 --- a/rails/app/controllers/concerns/.keep +++ /dev/null
diff --git a/rails/app/controllers/lingo/application_controller.rb b/rails/app/controllers/lingo/application_controller.rb deleted file mode 100644 index 08b728f..0000000 --- a/rails/app/controllers/lingo/application_controller.rb +++ /dev/null
@@ -1,5 +0,0 @@
1module Lingo
2 class ApplicationController < ActionController::Base
3 protect_from_forgery with: :exception
4 end
5end
diff --git a/rails/app/controllers/lingo/scores_controller.rb b/rails/app/controllers/lingo/scores_controller.rb deleted file mode 100644 index 59bbd9d..0000000 --- a/rails/app/controllers/lingo/scores_controller.rb +++ /dev/null
@@ -1,25 +0,0 @@
1module Lingo
2 class ScoresController < ApplicationController
3 skip_before_action :verify_authenticity_token, only: [:update]
4
5 def index
6 @scores = Score.order(score: :desc)
7 end
8
9 def update
10 if params[:secret_code] != Lingo.secret_code then
11 head :unauthorized
12 else
13 score = Score.find_or_create_by(user_id: params[:user_id]) do |score|
14 score.score = 0
15 end
16 score.username = params[:username]
17 score.avatar_url = CGI.unescape(params[:avatar_url])
18 score.score += 1
19 score.save!
20
21 head :created
22 end
23 end
24 end
25end