Initial app
Some checks are pending
CI / scan_ruby (push) Waiting to run
CI / scan_js (push) Waiting to run
CI / lint (push) Waiting to run
CI / test (push) Waiting to run

This commit is contained in:
sto
2025-03-14 15:36:05 +01:00
parent 8e9bf30547
commit 50280ce389
136 changed files with 3127 additions and 60 deletions

View File

@@ -0,0 +1,3 @@
class ApplicationRecord < ActiveRecord::Base
primary_abstract_class
end

View File

3
app/models/contest.rb Normal file
View File

@@ -0,0 +1,3 @@
class Contest < ApplicationRecord
belongs_to :user
end

4
app/models/current.rb Normal file
View File

@@ -0,0 +1,4 @@
class Current < ActiveSupport::CurrentAttributes
attribute :session
delegate :user, to: :session, allow_nil: true
end

4
app/models/puzzle.rb Normal file
View File

@@ -0,0 +1,4 @@
class Puzzle < ApplicationRecord
has_one_attached :image
validates :name, presence: true
end

3
app/models/session.rb Normal file
View File

@@ -0,0 +1,3 @@
class Session < ApplicationRecord
belongs_to :user
end

7
app/models/user.rb Normal file
View File

@@ -0,0 +1,7 @@
class User < ApplicationRecord
has_many :contests, dependent: :destroy
has_many :sessions, dependent: :destroy
has_secure_password
normalizes :email_address, with: ->(e) { e.strip.downcase }
end