diff options
| author | _Tradam <[email protected]> | 2024-06-17 00:52:52 -0400 |
|---|---|---|
| committer | _Tradam <[email protected]> | 2024-06-17 00:52:52 -0400 |
| commit | 4daccc9921a4876da7441eb650f908be67ddd819 (patch) | |
| tree | e6fed77f7fa978a053bfe97c59e8bcc35886ecfd | |
| parent | c0faec4aaf819017f5c4f1083816aaad026e5ccc (diff) | |
| download | gameHolster-4daccc9921a4876da7441eb650f908be67ddd819.tar.gz gameHolster-4daccc9921a4876da7441eb650f908be67ddd819.zip | |
allow uploading game with no tags
| -rw-r--r-- | app/controllers/api/v1/games_controller.rb | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/app/controllers/api/v1/games_controller.rb b/app/controllers/api/v1/games_controller.rb index f40c9de..6a412c8 100644 --- a/app/controllers/api/v1/games_controller.rb +++ b/app/controllers/api/v1/games_controller.rb @@ -16,10 +16,12 @@ class Api::V1::GamesController < ApplicationController @game = user.games.new(game_params.except(:status, :platform_tag)) @game.titleSlug = game_params[:title].parameterize @game.status = game_params[:status].to_i - params["game"]["platform_tag"].each do |tag| - tag_obj = Tag.find_by(tag_type: "platform", name: tag) - if tag_obj - @game.tags << tag_obj + if !params["game"]["platform_tag"].nil? + params["game"]["platform_tag"].each do |tag| + tag_obj = Tag.find_by(tag_type: "platform", name: tag) + if tag_obj + @game.tags << tag_obj + end end end @@ -121,9 +123,9 @@ class Api::V1::GamesController < ApplicationController render html: result.download.html_safe elsif format == "js" render js: result.download.html_safe - #else - # redirect_to url_for(result) - #end + #else + # redirect_to url_for(result) + #end elsif format == "gz" response.headers['Content-Encoding'] = 'gzip' second_ext = filename.rpartition('.').first.rpartition('.').last |
