summaryrefslogtreecommitdiffhomepage
path: root/app/controllers/api/v1/games_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/api/v1/games_controller.rb')
-rw-r--r--app/controllers/api/v1/games_controller.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/app/controllers/api/v1/games_controller.rb b/app/controllers/api/v1/games_controller.rb
index 073eec9..75d08a9 100644
--- a/app/controllers/api/v1/games_controller.rb
+++ b/app/controllers/api/v1/games_controller.rb
@@ -1,18 +1,24 @@
class Api::V1::GamesController < ApplicationController
skip_before_action :verify_authenticity_token
def create
- puts request.methods.sort
@game = Game.new(games_params)
if @game.save
+ pp @game
render json: @game, status: :created
else
render json: @game.errors, status: :unprocessable_entity
end
end
+ def index
+ game = Game.all.order(created_at: :desc)
+ #render json: game
+ render html: Game.first.game_file.download.html_safe
+ end
+
private
def games_params
- params.require(:game).permit(:title, :game_file)
+ params.require(:game).permit(:title, game_files:)
end
end