Dump
Some checks failed
CI / scan_ruby (push) Has been cancelled
CI / scan_js (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
Some checks failed
CI / scan_ruby (push) Has been cancelled
CI / scan_js (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
This commit is contained in:
commit
ef378a1f59
147 changed files with 3891 additions and 0 deletions
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
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
|
9
app/models/product.rb
Normal file
9
app/models/product.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
class Product < ApplicationRecord
|
||||
has_many :subscribers, dependent: :destroy
|
||||
|
||||
has_one_attached :featured_image
|
||||
has_rich_text :description
|
||||
|
||||
validates :name, presence: true
|
||||
validates :inventory_count, numericality: { greater_than_or_equal_to: 0 }
|
||||
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
|
3
app/models/subscriber.rb
Normal file
3
app/models/subscriber.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
class Subscriber < ApplicationRecord
|
||||
belongs_to :product
|
||||
end
|
6
app/models/user.rb
Normal file
6
app/models/user.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
class User < ApplicationRecord
|
||||
has_secure_password
|
||||
has_many :sessions, dependent: :destroy
|
||||
|
||||
normalizes :email_address, with: ->(e) { e.strip.downcase }
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue