#2 完了
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
||||
source "https://rubygems.org"
|
||||
|
||||
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
|
||||
gem "rails", "~> 8.0.1"
|
||||
gem "rails", "~> 8.0.2"
|
||||
# Use sqlite3 as the database for Active Record
|
||||
gem "sqlite3", ">= 2.1"
|
||||
# Use the Puma web server [https://github.com/puma/puma]
|
||||
|
||||
+54
-54
@@ -1,29 +1,29 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actioncable (8.0.1)
|
||||
actionpack (= 8.0.1)
|
||||
activesupport (= 8.0.1)
|
||||
actioncable (8.0.2)
|
||||
actionpack (= 8.0.2)
|
||||
activesupport (= 8.0.2)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
zeitwerk (~> 2.6)
|
||||
actionmailbox (8.0.1)
|
||||
actionpack (= 8.0.1)
|
||||
activejob (= 8.0.1)
|
||||
activerecord (= 8.0.1)
|
||||
activestorage (= 8.0.1)
|
||||
activesupport (= 8.0.1)
|
||||
actionmailbox (8.0.2)
|
||||
actionpack (= 8.0.2)
|
||||
activejob (= 8.0.2)
|
||||
activerecord (= 8.0.2)
|
||||
activestorage (= 8.0.2)
|
||||
activesupport (= 8.0.2)
|
||||
mail (>= 2.8.0)
|
||||
actionmailer (8.0.1)
|
||||
actionpack (= 8.0.1)
|
||||
actionview (= 8.0.1)
|
||||
activejob (= 8.0.1)
|
||||
activesupport (= 8.0.1)
|
||||
actionmailer (8.0.2)
|
||||
actionpack (= 8.0.2)
|
||||
actionview (= 8.0.2)
|
||||
activejob (= 8.0.2)
|
||||
activesupport (= 8.0.2)
|
||||
mail (>= 2.8.0)
|
||||
rails-dom-testing (~> 2.2)
|
||||
actionpack (8.0.1)
|
||||
actionview (= 8.0.1)
|
||||
activesupport (= 8.0.1)
|
||||
actionpack (8.0.2)
|
||||
actionview (= 8.0.2)
|
||||
activesupport (= 8.0.2)
|
||||
nokogiri (>= 1.8.5)
|
||||
rack (>= 2.2.4)
|
||||
rack-session (>= 1.0.1)
|
||||
@@ -31,35 +31,35 @@ GEM
|
||||
rails-dom-testing (~> 2.2)
|
||||
rails-html-sanitizer (~> 1.6)
|
||||
useragent (~> 0.16)
|
||||
actiontext (8.0.1)
|
||||
actionpack (= 8.0.1)
|
||||
activerecord (= 8.0.1)
|
||||
activestorage (= 8.0.1)
|
||||
activesupport (= 8.0.1)
|
||||
actiontext (8.0.2)
|
||||
actionpack (= 8.0.2)
|
||||
activerecord (= 8.0.2)
|
||||
activestorage (= 8.0.2)
|
||||
activesupport (= 8.0.2)
|
||||
globalid (>= 0.6.0)
|
||||
nokogiri (>= 1.8.5)
|
||||
actionview (8.0.1)
|
||||
activesupport (= 8.0.1)
|
||||
actionview (8.0.2)
|
||||
activesupport (= 8.0.2)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.11)
|
||||
rails-dom-testing (~> 2.2)
|
||||
rails-html-sanitizer (~> 1.6)
|
||||
activejob (8.0.1)
|
||||
activesupport (= 8.0.1)
|
||||
activejob (8.0.2)
|
||||
activesupport (= 8.0.2)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (8.0.1)
|
||||
activesupport (= 8.0.1)
|
||||
activerecord (8.0.1)
|
||||
activemodel (= 8.0.1)
|
||||
activesupport (= 8.0.1)
|
||||
activemodel (8.0.2)
|
||||
activesupport (= 8.0.2)
|
||||
activerecord (8.0.2)
|
||||
activemodel (= 8.0.2)
|
||||
activesupport (= 8.0.2)
|
||||
timeout (>= 0.4.0)
|
||||
activestorage (8.0.1)
|
||||
actionpack (= 8.0.1)
|
||||
activejob (= 8.0.1)
|
||||
activerecord (= 8.0.1)
|
||||
activesupport (= 8.0.1)
|
||||
activestorage (8.0.2)
|
||||
actionpack (= 8.0.2)
|
||||
activejob (= 8.0.2)
|
||||
activerecord (= 8.0.2)
|
||||
activesupport (= 8.0.2)
|
||||
marcel (~> 1.0)
|
||||
activesupport (8.0.1)
|
||||
activesupport (8.0.2)
|
||||
base64
|
||||
benchmark (>= 0.3)
|
||||
bigdecimal
|
||||
@@ -195,20 +195,20 @@ GEM
|
||||
rack (>= 1.3)
|
||||
rackup (2.2.1)
|
||||
rack (>= 3)
|
||||
rails (8.0.1)
|
||||
actioncable (= 8.0.1)
|
||||
actionmailbox (= 8.0.1)
|
||||
actionmailer (= 8.0.1)
|
||||
actionpack (= 8.0.1)
|
||||
actiontext (= 8.0.1)
|
||||
actionview (= 8.0.1)
|
||||
activejob (= 8.0.1)
|
||||
activemodel (= 8.0.1)
|
||||
activerecord (= 8.0.1)
|
||||
activestorage (= 8.0.1)
|
||||
activesupport (= 8.0.1)
|
||||
rails (8.0.2)
|
||||
actioncable (= 8.0.2)
|
||||
actionmailbox (= 8.0.2)
|
||||
actionmailer (= 8.0.2)
|
||||
actionpack (= 8.0.2)
|
||||
actiontext (= 8.0.2)
|
||||
actionview (= 8.0.2)
|
||||
activejob (= 8.0.2)
|
||||
activemodel (= 8.0.2)
|
||||
activerecord (= 8.0.2)
|
||||
activestorage (= 8.0.2)
|
||||
activesupport (= 8.0.2)
|
||||
bundler (>= 1.15.0)
|
||||
railties (= 8.0.1)
|
||||
railties (= 8.0.2)
|
||||
rails-dom-testing (2.2.0)
|
||||
activesupport (>= 5.0.0)
|
||||
minitest
|
||||
@@ -216,9 +216,9 @@ GEM
|
||||
rails-html-sanitizer (1.6.2)
|
||||
loofah (~> 2.21)
|
||||
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
||||
railties (8.0.1)
|
||||
actionpack (= 8.0.1)
|
||||
activesupport (= 8.0.1)
|
||||
railties (8.0.2)
|
||||
actionpack (= 8.0.2)
|
||||
activesupport (= 8.0.2)
|
||||
irb (~> 1.13)
|
||||
rackup (>= 1.0.0)
|
||||
rake (>= 12.2)
|
||||
@@ -340,7 +340,7 @@ DEPENDENCIES
|
||||
mysql2 (~> 0.5.6)
|
||||
puma (>= 5.0)
|
||||
rack-cors
|
||||
rails (~> 8.0.1)
|
||||
rails (~> 8.0.2)
|
||||
rubocop-rails-omakase
|
||||
solid_cable
|
||||
solid_cache
|
||||
|
||||
@@ -3,7 +3,7 @@ class NicoTagRelation < ApplicationRecord
|
||||
belongs_to :tag, class_name: 'Tag', foreign_key: 'tag_id'
|
||||
|
||||
validates :nico_tag_id, presence: true
|
||||
validates :tag_id, prosence: true
|
||||
validates :tag_id, presence: true
|
||||
|
||||
validate :nico_tag_must_be_nico
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
class Post < ApplicationRecord
|
||||
belongs_to :parent, class_name: 'Post', optional: true, foreign_key: 'parent_id'
|
||||
belongs_to :user, foreign_key: ''
|
||||
has_many :post_tags, dependent: :destroy
|
||||
has_many :tags, through: :post_tags
|
||||
has_many :user_post_views, dependent: :destroy
|
||||
end
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
class PostTag < ApplicationRecord
|
||||
belongs_to :post
|
||||
belongs_to :tag
|
||||
|
||||
validates :post_id, presence: true
|
||||
validates :tag_id, presence: true
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
class Setting < ApplicationRecord
|
||||
belongs_to :user
|
||||
|
||||
validates :user_id, presence: true
|
||||
validates :key, presence: true, length: { maximum: 255 }
|
||||
validates :value, presence: true
|
||||
end
|
||||
@@ -1,4 +1,9 @@
|
||||
class Tag < ApplicationRecord
|
||||
has_many :post_tags, dependent: :destroy
|
||||
has_many :posts, through: :post_tags
|
||||
has_many :tag_aliases, dependent: :destroy
|
||||
has_many :wiki_pages, dependent: :nullify
|
||||
|
||||
validates :name, presence: true, length: { maximum: 255 }
|
||||
validates :category, presence: true, inclusion: { in: categories.keys }
|
||||
|
||||
@@ -10,5 +15,5 @@ class Tag < ApplicationRecord
|
||||
nico: 'nico',
|
||||
meta: 'meta' }
|
||||
|
||||
scope :nico_tags, -> { where(category: :nico) }
|
||||
scope :nico_tags, -> { where category: :nico }
|
||||
end
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
class TagAlias < ApplicationRecord
|
||||
belongs_to :tag
|
||||
|
||||
validates :tag_id, presence: true
|
||||
validates :name, presence: true, length: { maximum: 255 }, uniqueness: true
|
||||
end
|
||||
@@ -9,4 +9,18 @@ class User < ApplicationRecord
|
||||
has_many :posts
|
||||
has_many :settings
|
||||
has_many :ip_addresses
|
||||
has_many :user_ips, dependent: :destroy
|
||||
has_many :ip_addresses, through: :user_ips
|
||||
has_many :user_post_views, dependent: :destroy
|
||||
has_many :viewed_posts, through: :user_post_views, source: :post
|
||||
has_many :created_wiki_pages, { class_name: 'WikiPage',
|
||||
foreign_key: 'created_user_id',
|
||||
dependent: :nullify }
|
||||
has_many :updated_wiki_pages, { class_name: 'WikiPage',
|
||||
foreign_key: 'updated_user_id',
|
||||
dependent: :nullify }
|
||||
|
||||
def viewed? post
|
||||
user_post_views.exists? post_id: post.id, viewed: true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
class UserIp < ApplicationRecord
|
||||
belongs_to :user
|
||||
belongs_to :ip_address
|
||||
|
||||
validates :user_id, presence: true
|
||||
validates :ip_address_id, presence: true
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
class UserPostView < ApplicationRecord
|
||||
belongs_to :user
|
||||
belongs_to :post
|
||||
|
||||
validates :user_id, presence: true
|
||||
validates :post_id, presence: true
|
||||
end
|
||||
@@ -0,0 +1,11 @@
|
||||
class WikiPage < ApplicationRecord
|
||||
belongs_to :tag, optional: true
|
||||
belongs_to :created_user, class_name: 'User', foreign_key: 'created_user_id'
|
||||
belongs_to :updated_user, class_name: 'User', foreign_key: 'updated_user_id'
|
||||
|
||||
validates :title, presence: true, length: { maximum: 255 }, uniqueness: true
|
||||
|
||||
def gollum_path
|
||||
"wiki/#{ title.parameterize }.md"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user