Permalink
Browse files

add urls when creating a new game

  • Loading branch information...
1 parent 016d75f commit 081223f5d3c4529e5608646fc30c54c680848726 Casey Kolderup committed May 17, 2012
Showing with 4 additions and 1 deletion.
  1. +1 −0 routes/api/find.rb
  2. +3 −1 routes/editor.rb
View
@@ -57,6 +57,7 @@ def add_version(game, params)
game = Game.new(:author => current_user)
version = add_version(game, params)
url = Url.new(:title => version.title, :game => game)
+ game.urls << url
error 422 unless game.save && version.save && url.save
View
@@ -23,8 +23,10 @@
game = Game.create author: current_user
version = Version.new_from_yaml_and_game(params[:game][:source], game)
+ url = Url.new(:title => version.title, :game => game)
+ game.urls << url
- if game.save && version.save
+ if game.save && version.save && url.save
flash[:success] = "Your game is saved."
redirect "/editor/#{game.id}"
else

0 comments on commit 081223f

Please sign in to comment.