diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/wittle/puzzles_controller.rb | 2 | ||||
-rw-r--r-- | app/models/wittle/score.rb | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/app/controllers/wittle/puzzles_controller.rb b/app/controllers/wittle/puzzles_controller.rb index 9d846f9..a937aa1 100644 --- a/app/controllers/wittle/puzzles_controller.rb +++ b/app/controllers/wittle/puzzles_controller.rb | |||
@@ -93,7 +93,7 @@ module Wittle | |||
93 | 93 | ||
94 | raise ActiveRecord::RecordNotFound unless @puzzle.latest? | 94 | raise ActiveRecord::RecordNotFound unless @puzzle.latest? |
95 | 95 | ||
96 | @puzzle.scores.create!(name: params[:name], ip: request.ip, seconds_taken: (params.include? :time) ? params[:time] : nil) | 96 | @puzzle.scores.create(name: params[:name], ip: request.ip, seconds_taken: (params.include? :time) ? params[:time] : nil) |
97 | 97 | ||
98 | redirect_to @puzzle | 98 | redirect_to @puzzle |
99 | end | 99 | end |
diff --git a/app/models/wittle/score.rb b/app/models/wittle/score.rb index be00fda..54d2b89 100644 --- a/app/models/wittle/score.rb +++ b/app/models/wittle/score.rb | |||
@@ -4,5 +4,6 @@ module Wittle | |||
4 | 4 | ||
5 | validates :name, presence: true | 5 | validates :name, presence: true |
6 | validates :ip, presence: true | 6 | validates :ip, presence: true |
7 | validates_uniqueness_of :name, scope: :puzzle_id | ||
7 | end | 8 | end |
8 | end | 9 | end |