From e26863dbf7bc8f07ba35029082cf45c95f62e921 Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Wed, 29 Apr 2020 21:54:14 +0200 Subject: [PATCH] Remove stamper from essences We do not need the creator and updater information on the essences. We already have them on the elements. --- app/models/alchemy/essence_boolean.rb | 2 -- app/models/alchemy/essence_date.rb | 2 -- app/models/alchemy/essence_file.rb | 2 -- app/models/alchemy/essence_html.rb | 2 -- app/models/alchemy/essence_link.rb | 2 -- app/models/alchemy/essence_picture.rb | 2 -- app/models/alchemy/essence_richtext.rb | 2 -- app/models/alchemy/essence_select.rb | 2 -- app/models/alchemy/essence_text.rb | 2 -- .../20200226213334_alchemy_four_point_four.rb | 18 ------------------ lib/alchemy/essence.rb | 2 +- spec/dummy/db/schema.rb | 18 ------------------ 12 files changed, 1 insertion(+), 55 deletions(-) diff --git a/app/models/alchemy/essence_boolean.rb b/app/models/alchemy/essence_boolean.rb index fbbdc97fd2..075ef37f6a 100644 --- a/app/models/alchemy/essence_boolean.rb +++ b/app/models/alchemy/essence_boolean.rb @@ -8,8 +8,6 @@ # value :boolean # created_at :datetime not null # updated_at :datetime not null -# creator_id :integer -# updater_id :integer # # Stores boolean values. diff --git a/app/models/alchemy/essence_date.rb b/app/models/alchemy/essence_date.rb index a79da66fd9..d3b7db2b4e 100644 --- a/app/models/alchemy/essence_date.rb +++ b/app/models/alchemy/essence_date.rb @@ -6,8 +6,6 @@ # # id :integer not null, primary key # date :datetime -# creator_id :integer -# updater_id :integer # created_at :datetime not null # updated_at :datetime not null # diff --git a/app/models/alchemy/essence_file.rb b/app/models/alchemy/essence_file.rb index 0f45190d38..3485d53a3a 100644 --- a/app/models/alchemy/essence_file.rb +++ b/app/models/alchemy/essence_file.rb @@ -8,8 +8,6 @@ # attachment_id :integer # title :string # css_class :string -# creator_id :integer -# updater_id :integer # created_at :datetime not null # updated_at :datetime not null # link_text :string diff --git a/app/models/alchemy/essence_html.rb b/app/models/alchemy/essence_html.rb index b4a3c823da..09208db337 100644 --- a/app/models/alchemy/essence_html.rb +++ b/app/models/alchemy/essence_html.rb @@ -6,8 +6,6 @@ # # id :integer not null, primary key # source :text -# creator_id :integer -# updater_id :integer # created_at :datetime not null # updated_at :datetime not null # diff --git a/app/models/alchemy/essence_link.rb b/app/models/alchemy/essence_link.rb index 8959cd7c22..77735d8d22 100644 --- a/app/models/alchemy/essence_link.rb +++ b/app/models/alchemy/essence_link.rb @@ -11,8 +11,6 @@ # link_class_name :string # created_at :datetime not null # updated_at :datetime not null -# creator_id :integer -# updater_id :integer # module Alchemy diff --git a/app/models/alchemy/essence_picture.rb b/app/models/alchemy/essence_picture.rb index 736d22441a..82c1d5eeb1 100644 --- a/app/models/alchemy/essence_picture.rb +++ b/app/models/alchemy/essence_picture.rb @@ -14,8 +14,6 @@ # link_title :string # css_class :string # link_target :string -# creator_id :integer -# updater_id :integer # created_at :datetime not null # updated_at :datetime not null # crop_from :string diff --git a/app/models/alchemy/essence_richtext.rb b/app/models/alchemy/essence_richtext.rb index 44093acc35..606b1af90b 100644 --- a/app/models/alchemy/essence_richtext.rb +++ b/app/models/alchemy/essence_richtext.rb @@ -8,8 +8,6 @@ # body :text # stripped_body :text # public :boolean -# creator_id :integer -# updater_id :integer # created_at :datetime not null # updated_at :datetime not null # diff --git a/app/models/alchemy/essence_select.rb b/app/models/alchemy/essence_select.rb index ced0384e95..167e94abda 100644 --- a/app/models/alchemy/essence_select.rb +++ b/app/models/alchemy/essence_select.rb @@ -8,8 +8,6 @@ # value :string # created_at :datetime not null # updated_at :datetime not null -# creator_id :integer -# updater_id :integer # # Provides a select box that stores string values. diff --git a/app/models/alchemy/essence_text.rb b/app/models/alchemy/essence_text.rb index 7f10c0ef1c..dbde3047dd 100644 --- a/app/models/alchemy/essence_text.rb +++ b/app/models/alchemy/essence_text.rb @@ -11,8 +11,6 @@ # link_class_name :string # public :boolean default(FALSE) # link_target :string -# creator_id :integer -# updater_id :integer # created_at :datetime not null # updated_at :datetime not null # diff --git a/db/migrate/20200226213334_alchemy_four_point_four.rb b/db/migrate/20200226213334_alchemy_four_point_four.rb index 3de012be7a..7133571e4a 100644 --- a/db/migrate/20200226213334_alchemy_four_point_four.rb +++ b/db/migrate/20200226213334_alchemy_four_point_four.rb @@ -65,8 +65,6 @@ def up t.boolean "value" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false - t.integer "creator_id" - t.integer "updater_id" t.index ["value"], name: "index_alchemy_essence_booleans_on_value" end end @@ -74,8 +72,6 @@ def up unless table_exists?("alchemy_essence_dates") create_table "alchemy_essence_dates", force: :cascade do |t| t.datetime "date" - t.integer "creator_id" - t.integer "updater_id" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false end @@ -86,8 +82,6 @@ def up t.integer "attachment_id" t.string "title" t.string "css_class" - t.integer "creator_id" - t.integer "updater_id" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false t.string "link_text" @@ -98,8 +92,6 @@ def up unless table_exists?("alchemy_essence_htmls") create_table "alchemy_essence_htmls", force: :cascade do |t| t.text "source" - t.integer "creator_id" - t.integer "updater_id" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false end @@ -113,8 +105,6 @@ def up t.string "link_class_name" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false - t.integer "creator_id" - t.integer "updater_id" end end @@ -138,8 +128,6 @@ def up t.string "link_title" t.string "css_class" t.string "link_target" - t.integer "creator_id" - t.integer "updater_id" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false t.string "crop_from" @@ -154,8 +142,6 @@ def up t.text "body" t.text "stripped_body" t.boolean "public" - t.integer "creator_id" - t.integer "updater_id" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false end @@ -166,8 +152,6 @@ def up t.string "value" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false - t.integer "creator_id" - t.integer "updater_id" t.index ["value"], name: "index_alchemy_essence_selects_on_value" end end @@ -180,8 +164,6 @@ def up t.string "link_class_name" t.boolean "public", default: false t.string "link_target" - t.integer "creator_id" - t.integer "updater_id" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false end diff --git a/lib/alchemy/essence.rb b/lib/alchemy/essence.rb index 2b14019554..d99e526668 100644 --- a/lib/alchemy/essence.rb +++ b/lib/alchemy/essence.rb @@ -48,7 +48,7 @@ def acts_as_essence(options = {}) class_eval <<-RUBY, __FILE__, __LINE__ + 1 attr_writer :validation_errors include Alchemy::Essence::InstanceMethods - stampable stamper_class_name: Alchemy.user_class_name + validate :validate_ingredient, on: :update, if: -> { validations.any? } has_one :content, as: :essence, class_name: "Alchemy::Content", inverse_of: :essence diff --git a/spec/dummy/db/schema.rb b/spec/dummy/db/schema.rb index 74697e085d..b6c289191b 100644 --- a/spec/dummy/db/schema.rb +++ b/spec/dummy/db/schema.rb @@ -66,15 +66,11 @@ t.boolean "value" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false - t.integer "creator_id" - t.integer "updater_id" t.index ["value"], name: "index_alchemy_essence_booleans_on_value" end create_table "alchemy_essence_dates", force: :cascade do |t| t.datetime "date" - t.integer "creator_id" - t.integer "updater_id" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false end @@ -83,8 +79,6 @@ t.integer "attachment_id" t.string "title" t.string "css_class" - t.integer "creator_id" - t.integer "updater_id" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false t.string "link_text" @@ -93,8 +87,6 @@ create_table "alchemy_essence_htmls", force: :cascade do |t| t.text "source" - t.integer "creator_id" - t.integer "updater_id" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false end @@ -106,8 +98,6 @@ t.string "link_class_name" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false - t.integer "creator_id" - t.integer "updater_id" end create_table "alchemy_essence_nodes", force: :cascade do |t| @@ -134,8 +124,6 @@ t.string "link_title" t.string "css_class" t.string "link_target" - t.integer "creator_id" - t.integer "updater_id" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false t.string "crop_from" @@ -148,8 +136,6 @@ t.text "body" t.text "stripped_body" t.boolean "public" - t.integer "creator_id" - t.integer "updater_id" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false end @@ -158,8 +144,6 @@ t.string "value" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false - t.integer "creator_id" - t.integer "updater_id" t.index ["value"], name: "index_alchemy_essence_selects_on_value" end @@ -170,8 +154,6 @@ t.string "link_class_name" t.boolean "public", default: false t.string "link_target" - t.integer "creator_id" - t.integer "updater_id" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false end