Track creator

This commit is contained in:
Jason Zimdars
2024-08-14 16:41:59 -05:00
parent 8b23dfe52f
commit 2ff9dbab51
6 changed files with 14 additions and 2 deletions
+2
View File
@@ -2,6 +2,8 @@ class Splat < ApplicationRecord
has_many :categorizations
has_many :categories, through: :categorizations, dependent: :destroy
belongs_to :creator, class_name: "User", default: -> { Current.user }
enum :color, %w[
#AF2E1B #CC6324 #3B4B59 #BFA07A #ED8008 #ED3F1C #BF1B1B #736B1E #D07B53
#736356 #AD1D1D #BF7C2A #C09C6F #698F9C #7C956B #5D618F #3B3633 #67695E
+1
View File
@@ -1,6 +1,7 @@
class User < ApplicationRecord
belongs_to :organization
has_many :sessions, dependent: :destroy
has_many :splats, dependent: :destroy
has_secure_password validations: false
+1 -1
View File
@@ -41,7 +41,7 @@
<div class="comment flex align-start gap">
<header class="full-width margin-block">
Added by <strong>Jason Zimdars</strong> on <%= @splat.created_at.strftime("%B %d") %> (<%= time_ago_in_words @splat.created_at %> ago).
Added by <strong><%= @splat.creator.name %></strong> on <%= @splat.created_at.strftime("%B %d") %> (<%= time_ago_in_words @splat.created_at %> ago).
</header>
</div>
@@ -0,0 +1,5 @@
class AddCreatorToSplats < ActiveRecord::Migration[8.0]
def change
add_column :splats, :creator_id, :integer, null: false
end
end
Generated
+2 -1
View File
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.0].define(version: 2024_07_24_163519) do
ActiveRecord::Schema[8.0].define(version: 2024_08_14_210043) do
create_table "categories", force: :cascade do |t|
t.string "title"
t.datetime "created_at", null: false
@@ -51,6 +51,7 @@ ActiveRecord::Schema[8.0].define(version: 2024_07_24_163519) do
t.string "color"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "creator_id", null: false
end
create_table "users", force: :cascade do |t|
+3
View File
@@ -4,13 +4,16 @@ one:
title: The logo isn't big enough
body: Make the logo bigger.
color: '#AF2E1B'
creator: :david
two:
title: Layout is broken
body: The page scrolls horizontally on mobile devices.
color: '#CC6324'
creator: :jz
three:
title: The text is too small
body: Increase the font size.
color: '#3B4B59'
creator: :kevin