add activeadmin

This commit is contained in:
João Geonizeli
2022-07-20 22:57:39 -03:00
parent ae7d31bc1b
commit 5e0d3def6d
12 changed files with 501 additions and 19 deletions

View File

@@ -0,0 +1,16 @@
class CreateActiveAdminComments < ActiveRecord::Migration[7.0]
def self.up
create_table :active_admin_comments do |t|
t.string :namespace
t.text :body
t.references :resource, polymorphic: true
t.references :author, polymorphic: true
t.timestamps
end
add_index :active_admin_comments, [:namespace]
end
def self.down
drop_table :active_admin_comments
end
end

16
db/schema.rb generated
View File

@@ -10,10 +10,24 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2022_07_21_002916) do
ActiveRecord::Schema[7.0].define(version: 2022_07_21_015136) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "active_admin_comments", force: :cascade do |t|
t.string "namespace"
t.text "body"
t.string "resource_type"
t.bigint "resource_id"
t.string "author_type"
t.bigint "author_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["author_type", "author_id"], name: "index_active_admin_comments_on_author"
t.index ["namespace"], name: "index_active_admin_comments_on_namespace"
t.index ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource"
end
create_table "users", force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false

View File

@@ -5,3 +5,4 @@
#
# movies = Movie.create([{ name: "Star Wars" }, { name: "Lord of the Rings" }])
# Character.create(name: "Luke", movie: movies.first)
User.create!(email: 'admin@example.com', name: 'Admin User', password: 'password', password_confirmation: 'password')