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

This commit is contained in:
Bill Niblock 2025-01-24 12:32:29 -05:00
commit ef378a1f59
147 changed files with 3891 additions and 0 deletions

View file

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

View file

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

9
app/models/product.rb Normal file
View 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
View file

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

3
app/models/subscriber.rb Normal file
View file

@ -0,0 +1,3 @@
class Subscriber < ApplicationRecord
belongs_to :product
end

6
app/models/user.rb Normal file
View 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