Initial app
This commit is contained in:
3
app/models/application_record.rb
Normal file
3
app/models/application_record.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
class ApplicationRecord < ActiveRecord::Base
|
||||
primary_abstract_class
|
||||
end
|
0
app/models/concerns/.keep
Normal file
0
app/models/concerns/.keep
Normal file
3
app/models/contest.rb
Normal file
3
app/models/contest.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
class Contest < ApplicationRecord
|
||||
belongs_to :user
|
||||
end
|
4
app/models/current.rb
Normal file
4
app/models/current.rb
Normal 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
4
app/models/puzzle.rb
Normal file
@@ -0,0 +1,4 @@
|
||||
class Puzzle < ApplicationRecord
|
||||
has_one_attached :image
|
||||
validates :name, presence: true
|
||||
end
|
3
app/models/session.rb
Normal file
3
app/models/session.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
class Session < ApplicationRecord
|
||||
belongs_to :user
|
||||
end
|
7
app/models/user.rb
Normal file
7
app/models/user.rb
Normal 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
|
Reference in New Issue
Block a user