about summary refs log tree commit diff stats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/wittle/puzzle.rb12
-rw-r--r--app/models/wittle/score.rb8
2 files changed, 20 insertions, 0 deletions
diff --git a/app/models/wittle/puzzle.rb b/app/models/wittle/puzzle.rb new file mode 100644 index 0000000..e118d8a --- /dev/null +++ b/app/models/wittle/puzzle.rb
@@ -0,0 +1,12 @@
1module Wittle
2 class Puzzle < ApplicationRecord
3 extend Enumerize
4
5 has_many :scores
6
7 validates :data, presence: true
8
9 validates :category, presence: true
10 enumerize :category, in: [:normal, :hard, :expert], scope: :shallow
11 end
12end
diff --git a/app/models/wittle/score.rb b/app/models/wittle/score.rb new file mode 100644 index 0000000..be00fda --- /dev/null +++ b/app/models/wittle/score.rb
@@ -0,0 +1,8 @@
1module Wittle
2 class Score < ApplicationRecord
3 belongs_to :puzzle
4
5 validates :name, presence: true
6 validates :ip, presence: true
7 end
8end