about summary refs log tree commit diff stats
path: root/app
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-10-28 17:32:45 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-10-28 17:32:45 -0400
commit141f8b1a7e42928e94cccd0c8f89fdd56f8e2efe (patch)
tree234bc2a3ccd234b576330061db8a17ad785135ed /app
parentcfc41eb3ccc99b92220115b0710fb821525e1075 (diff)
downloadwittle-141f8b1a7e42928e94cccd0c8f89fdd56f8e2efe.tar.gz
wittle-141f8b1a7e42928e94cccd0c8f89fdd56f8e2efe.tar.bz2
wittle-141f8b1a7e42928e94cccd0c8f89fdd56f8e2efe.zip
created puzzle and score tables
Diffstat (limited to 'app')
-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