Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single Table Inheritance does not work correctly #144

Open
bruno-berchielli opened this issue Nov 3, 2023 · 2 comments
Open

Single Table Inheritance does not work correctly #144

bruno-berchielli opened this issue Nov 3, 2023 · 2 comments

Comments

@bruno-berchielli
Copy link

Hello,

The issue described persists as detailed here: #72.

I have set up a fresh Rails 7.0.8 installation with the latest version of the Motor Admin gem:
https://github.com/bruno-berchielli/sti-test.

This repository has only a few commits, with the latest being the creation of STI models.

Problems:

  • The parent category does not show any records.
  • Models that "belong to" a non-parent STI class do not list the options in the select dropdown on the creation form.

Captura de Tela 2023-11-03 às 11.48.49

Captura de Tela 2023-11-03 às 11.47.59

Captura de Tela 2023-11-03 às 12 02 51

This repository seems to work fine, although it runs on an older version of Rails and Ruby: https://github.com/james05/motor_admin_poc.

I would be happy to submit a PR to fix the issue if I could be pointed in the right direction. Given that this is a fairly extensive project with a lot of metaprogramming, I currently do not have the time to delve into the entire codebase.

@stefsava
Copy link
Contributor

stefsava commented Nov 8, 2023

I confirm the bug.

Workaround:
you can solve forcing add Pet resource in config/motor.yml. For example, enabling and disabling one of the fields.

With empty motor.yml file or/and without data in motor_resources data the pet query is

SELECT "pets".* FROM "pets" WHERE "pets"."type" = ? ORDER BY "pets"."id" DESC LIMIT ? OFFSET ?  
[["type", "Pet"], ["LIMIT", 20], ["OFFSET", 0]]

instead of

SELECT "pets".* FROM "pets" ORDER BY "pets"."id" DESC LIMIT ? OFFSET ?  
[["LIMIT", 20], ["OFFSET", 0]]

Issue log:

sti-test % rm db/development.sqlite3 config/motor.yml ; rails s -p 3000
=> Booting Puma
=> Rails 7.0.8 application starting in development 
=> Run `bin/rails server --help` for more startup options

 Motor::Admin is starting under /motor_admin

Puma starting in single mode...
* Puma version: 5.6.7 (ruby 3.2.2-p53) ("Birdie's Version")
*  Min threads: 5
*  Max threads: 5
*  Environment: development
*          PID: 98067
* Listening on http://127.0.0.1:3000
* Listening on http://[::1]:3000
Use Ctrl-C to stop
Started GET "/" for ::1 at 2023-11-08 17:55:16 +0100
   (2.5ms)  CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY)
   (0.9ms)  CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL)
  ActiveRecord::SchemaMigration Pluck (0.1ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
  
ActiveRecord::PendingMigrationError (

Migrations are pending. To resolve this issue, run:

        bin/rails db:migrate RAILS_ENV=development

You have 4 pending migrations:

20231103143621_install_motor_admin.rb
20231103143711_create_pet_owners.rb
20231103143728_create_pets.rb
20231103145430_create_dog_stuffs.rb


):
  
activerecord (7.0.8) lib/active_record/migration.rb:662:in `check_pending!'
activerecord (7.0.8) lib/active_record/migration.rb:627:in `block (2 levels) in call'
activesupport (7.0.8) lib/active_support/file_update_checker.rb:83:in `execute'
activerecord (7.0.8) lib/active_record/migration.rb:632:in `block in call'
activerecord (7.0.8) lib/active_record/migration.rb:624:in `synchronize'
activerecord (7.0.8) lib/active_record/migration.rb:624:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport (7.0.8) lib/active_support/callbacks.rb:99:in `run_callbacks'
actionpack (7.0.8) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
web-console (4.2.1) lib/web_console/middleware.rb:132:in `call_app'
web-console (4.2.1) lib/web_console/middleware.rb:28:in `block in call'
web-console (4.2.1) lib/web_console/middleware.rb:17:in `catch'
web-console (4.2.1) lib/web_console/middleware.rb:17:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/show_exceptions.rb:29:in `call'
railties (7.0.8) lib/rails/rack/logger.rb:40:in `call_app'
railties (7.0.8) lib/rails/rack/logger.rb:25:in `block in call'
activesupport (7.0.8) lib/active_support/tagged_logging.rb:99:in `block in tagged'
activesupport (7.0.8) lib/active_support/tagged_logging.rb:37:in `tagged'
activesupport (7.0.8) lib/active_support/tagged_logging.rb:99:in `tagged'
railties (7.0.8) lib/rails/rack/logger.rb:25:in `call'
sprockets-rails (3.4.2) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
request_store (1.5.1) lib/request_store/middleware.rb:19:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/request_id.rb:26:in `call'
rack (2.2.8) lib/rack/method_override.rb:24:in `call'
rack (2.2.8) lib/rack/runtime.rb:22:in `call'
activesupport (7.0.8) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/server_timing.rb:61:in `block in call'
actionpack (7.0.8) lib/action_dispatch/middleware/server_timing.rb:26:in `collect_events'
actionpack (7.0.8) lib/action_dispatch/middleware/server_timing.rb:60:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/static.rb:23:in `call'
rack (2.2.8) lib/rack/sendfile.rb:110:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/host_authorization.rb:138:in `call'
railties (7.0.8) lib/rails/engine.rb:530:in `call'
puma (5.6.7) lib/puma/configuration.rb:252:in `call'
puma (5.6.7) lib/puma/request.rb:77:in `block in handle_request'
puma (5.6.7) lib/puma/thread_pool.rb:340:in `with_force_shutdown'
puma (5.6.7) lib/puma/request.rb:76:in `handle_request'
puma (5.6.7) lib/puma/server.rb:443:in `process_client'
puma (5.6.7) lib/puma/thread_pool.rb:147:in `block in spawn_thread'
Started POST "/rails/actions" for ::1 at 2023-11-08 17:55:18 +0100
  ActiveRecord::SchemaMigration Pluck (0.1ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
Migrating to InstallMotorAdmin (20231103143621)
== 20231103143621 InstallMotorAdmin: migrating ================================
-- create_table(:motor_queries)
  TRANSACTION (0.0ms)  begin transaction
   (0.5ms)  CREATE TABLE "motor_queries" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "description" text, "sql_body" text NOT NULL, "preferences" text NOT NULL, "author_id" bigint, "author_type" varchar, "deleted_at" datetime(6), "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL)
   (0.2ms)  CREATE INDEX "index_motor_queries_on_updated_at" ON "motor_queries" ("updated_at")
   (0.1ms)  CREATE UNIQUE INDEX "motor_queries_name_unique_index" ON "motor_queries" ("name") WHERE deleted_at IS NULL
   -> 0.0049s
-- create_table(:motor_dashboards)
   (0.2ms)  CREATE TABLE "motor_dashboards" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar NOT NULL, "description" text, "preferences" text NOT NULL, "author_id" bigint, "author_type" varchar, "deleted_at" datetime(6), "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL)
   (0.1ms)  CREATE INDEX "index_motor_dashboards_on_updated_at" ON "motor_dashboards" ("updated_at")
   (0.1ms)  CREATE UNIQUE INDEX "motor_dashboards_title_unique_index" ON "motor_dashboards" ("title") WHERE deleted_at IS NULL
   -> 0.0025s
-- create_table(:motor_forms)
   (0.2ms)  CREATE TABLE "motor_forms" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "description" text, "api_path" text NOT NULL, "http_method" varchar NOT NULL, "preferences" text NOT NULL, "author_id" bigint, "author_type" varchar, "deleted_at" datetime(6), "api_config_name" varchar NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL)
   (0.1ms)  CREATE INDEX "index_motor_forms_on_updated_at" ON "motor_forms" ("updated_at")
   (0.2ms)  CREATE UNIQUE INDEX "motor_forms_name_unique_index" ON "motor_forms" ("name") WHERE deleted_at IS NULL
   -> 0.0033s
-- create_table(:motor_resources)
   (0.1ms)  CREATE TABLE "motor_resources" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "preferences" text NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL)
   (0.2ms)  CREATE UNIQUE INDEX "index_motor_resources_on_name" ON "motor_resources" ("name")
   (0.1ms)  CREATE INDEX "index_motor_resources_on_updated_at" ON "motor_resources" ("updated_at")
   -> 0.0034s
-- create_table(:motor_configs)
   (0.1ms)  CREATE TABLE "motor_configs" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "key" varchar NOT NULL, "value" text NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL)
   (0.1ms)  CREATE UNIQUE INDEX "index_motor_configs_on_key" ON "motor_configs" ("key")
   (0.1ms)  CREATE INDEX "index_motor_configs_on_updated_at" ON "motor_configs" ("updated_at")
   -> 0.0023s
-- create_table(:motor_alerts)
   (0.2ms)  CREATE TABLE "motor_alerts" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "query_id" integer NOT NULL, "name" varchar NOT NULL, "description" text, "to_emails" text NOT NULL, "is_enabled" boolean DEFAULT 1 NOT NULL, "preferences" text NOT NULL, "author_id" bigint, "author_type" varchar, "deleted_at" datetime(6), "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_8828951644"
FOREIGN KEY ("query_id")
  REFERENCES "motor_queries" ("id")
)
   (0.1ms)  CREATE INDEX "index_motor_alerts_on_query_id" ON "motor_alerts" ("query_id")
   (0.1ms)  CREATE INDEX "index_motor_alerts_on_updated_at" ON "motor_alerts" ("updated_at")
   (0.1ms)  CREATE UNIQUE INDEX "motor_alerts_name_unique_index" ON "motor_alerts" ("name") WHERE deleted_at IS NULL
   -> 0.0032s
-- create_table(:motor_alert_locks)
   (0.2ms)  CREATE TABLE "motor_alert_locks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "alert_id" integer NOT NULL, "lock_timestamp" varchar NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_38d1b2960e"
FOREIGN KEY ("alert_id")
  REFERENCES "motor_alerts" ("id")
)
   (0.1ms)  CREATE INDEX "index_motor_alert_locks_on_alert_id" ON "motor_alert_locks" ("alert_id")
   (0.1ms)  CREATE UNIQUE INDEX "index_motor_alert_locks_on_alert_id_and_lock_timestamp" ON "motor_alert_locks" ("alert_id", "lock_timestamp")
   -> 0.0024s
-- create_table(:motor_tags)
   (0.1ms)  CREATE TABLE "motor_tags" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL)
   (0.1ms)  CREATE UNIQUE INDEX "motor_tags_name_unique_index" ON "motor_tags" ("name")
   -> 0.0019s
-- create_table(:motor_taggable_tags)
   (0.2ms)  CREATE TABLE "motor_taggable_tags" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "tag_id" integer NOT NULL, "taggable_id" bigint NOT NULL, "taggable_type" varchar NOT NULL, CONSTRAINT "fk_rails_ba9ebe2280"
FOREIGN KEY ("tag_id")
  REFERENCES "motor_tags" ("id")
)
   (0.1ms)  CREATE INDEX "index_motor_taggable_tags_on_tag_id" ON "motor_taggable_tags" ("tag_id")
   (0.2ms)  CREATE UNIQUE INDEX "motor_polymorphic_association_tag_index" ON "motor_taggable_tags" ("taggable_id", "taggable_type", "tag_id")
   -> 0.0024s
-- create_table(:motor_audits)
   (0.2ms)  CREATE TABLE "motor_audits" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "auditable_id" varchar, "auditable_type" varchar, "associated_id" varchar, "associated_type" varchar, "user_id" bigint, "user_type" varchar, "username" varchar, "action" varchar, "audited_changes" text, "version" bigint DEFAULT 0, "comment" text, "remote_address" varchar, "request_uuid" varchar, "created_at" datetime(6))
   -> 0.0011s
-- create_table(:motor_api_configs)
   (0.2ms)  CREATE TABLE "motor_api_configs" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "url" varchar NOT NULL, "preferences" text NOT NULL, "credentials" text NOT NULL, "description" text, "deleted_at" datetime(6), "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL)
   (0.1ms)  CREATE UNIQUE INDEX "motor_api_configs_name_unique_index" ON "motor_api_configs" ("name") WHERE deleted_at IS NULL
   -> 0.0017s
-- create_table(:motor_notes)
   (0.2ms)  CREATE TABLE "motor_notes" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "body" text, "author_id" bigint, "author_type" varchar, "record_id" varchar NOT NULL, "record_type" varchar NOT NULL, "deleted_at" datetime(6), "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL)
   (0.1ms)  CREATE INDEX "motor_notes_record_id_record_type_index" ON "motor_notes" ("record_id", "record_type")
   (0.2ms)  CREATE INDEX "motor_notes_author_id_author_type_index" ON "motor_notes" ("author_id", "author_type")
   -> 0.0030s
-- create_table(:motor_note_tags)
   (0.2ms)  CREATE TABLE "motor_note_tags" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL)
   (0.2ms)  CREATE UNIQUE INDEX "motor_note_tags_name_unique_index" ON "motor_note_tags" ("name")
   -> 0.0066s
-- create_table(:motor_note_tag_tags)
   (0.2ms)  CREATE TABLE "motor_note_tag_tags" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "tag_id" integer NOT NULL, "note_id" integer NOT NULL, CONSTRAINT "fk_rails_f0bd88b67d"
FOREIGN KEY ("tag_id")
  REFERENCES "motor_note_tags" ("id")
, CONSTRAINT "fk_rails_5958bda098"
FOREIGN KEY ("note_id")
  REFERENCES "motor_notes" ("id")
)
   (0.1ms)  CREATE INDEX "index_motor_note_tag_tags_on_tag_id" ON "motor_note_tag_tags" ("tag_id")
   (0.1ms)  CREATE UNIQUE INDEX "motor_note_tags_note_id_tag_id_index" ON "motor_note_tag_tags" ("note_id", "tag_id")
   -> 0.0032s
-- create_table(:motor_reminders)
   (0.2ms)  CREATE TABLE "motor_reminders" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "author_id" bigint NOT NULL, "author_type" varchar NOT NULL, "recipient_id" bigint NOT NULL, "recipient_type" varchar NOT NULL, "record_id" varchar, "record_type" varchar, "scheduled_at" datetime(6) NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL)
   (0.1ms)  CREATE INDEX "index_motor_reminders_on_scheduled_at" ON "motor_reminders" ("scheduled_at")
   (0.1ms)  CREATE INDEX "motor_reminders_author_id_author_type_index" ON "motor_reminders" ("author_id", "author_type")
   (0.2ms)  CREATE INDEX "motor_reminders_recipient_id_recipient_type_index" ON "motor_reminders" ("recipient_id", "recipient_type")
   (0.1ms)  CREATE INDEX "motor_reminders_record_id_record_type_index" ON "motor_reminders" ("record_id", "record_type")
   -> 0.0052s
-- create_table(:motor_notifications)
   (0.2ms)  CREATE TABLE "motor_notifications" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar NOT NULL, "description" text, "recipient_id" bigint NOT NULL, "recipient_type" varchar NOT NULL, "record_id" varchar, "record_type" varchar, "status" varchar NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL)
   (0.1ms)  CREATE INDEX "motor_notifications_recipient_id_recipient_type_index" ON "motor_notifications" ("recipient_id", "recipient_type")
   (0.1ms)  CREATE INDEX "motor_notifications_record_id_record_type_index" ON "motor_notifications" ("record_id", "record_type")
   -> 0.0030s
-- add_index(:motor_audits, [:auditable_type, :auditable_id, :version], {:name=>"motor_auditable_index"})
   (0.1ms)  CREATE INDEX "motor_auditable_index" ON "motor_audits" ("auditable_type", "auditable_id", "version")
   -> 0.0008s
-- add_index(:motor_audits, [:associated_type, :associated_id], {:name=>"motor_auditable_associated_index"})
   (0.1ms)  CREATE INDEX "motor_auditable_associated_index" ON "motor_audits" ("associated_type", "associated_id")
   -> 0.0007s
-- add_index(:motor_audits, [:user_id, :user_type], {:name=>"motor_auditable_user_index"})
   (0.1ms)  CREATE INDEX "motor_auditable_user_index" ON "motor_audits" ("user_id", "user_type")
   -> 0.0007s
-- add_index(:motor_audits, :request_uuid)
   (0.1ms)  CREATE INDEX "index_motor_audits_on_request_uuid" ON "motor_audits" ("request_uuid")
   -> 0.0009s
-- add_index(:motor_audits, :created_at)
   (0.2ms)  CREATE INDEX "index_motor_audits_on_created_at" ON "motor_audits" ("created_at")
   -> 0.0008s
  #<Class:0x0000000114aca3e0> Create (0.1ms)  INSERT INTO "motor_configs" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?)  [["key", "header.links"], ["value", "[{\"name\":\"⭐ Star on GitHub\",\"path\":\"https://github.com/motor-admin/motor-admin-rails\"}]"], ["created_at", "2023-11-08 16:55:18.296279"], ["updated_at", "2023-11-08 16:55:18.296279"]]
  #<Class:0x0000000114aca3e0> Create (0.1ms)  INSERT INTO "motor_api_configs" ("name", "url", "preferences", "credentials", "description", "deleted_at", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?)  [["name", "origin"], ["url", "/"], ["preferences", "{}"], ["credentials", "{}"], ["description", nil], ["deleted_at", nil], ["created_at", "2023-11-08 16:55:18.304355"], ["updated_at", "2023-11-08 16:55:18.304355"]]
== 20231103143621 InstallMotorAdmin: migrated (0.0723s) =======================

  ActiveRecord::SchemaMigration Create (0.2ms)  INSERT INTO "schema_migrations" ("version") VALUES (?)  [["version", "20231103143621"]]
  TRANSACTION (1.3ms)  commit transaction
Migrating to CreatePetOwners (20231103143711)
== 20231103143711 CreatePetOwners: migrating ==================================
-- create_table(:pet_owners)
  TRANSACTION (0.0ms)  begin transaction
   (0.4ms)  CREATE TABLE "pet_owners" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL)
   -> 0.0017s
== 20231103143711 CreatePetOwners: migrated (0.0018s) =========================

  ActiveRecord::SchemaMigration Create (0.1ms)  INSERT INTO "schema_migrations" ("version") VALUES (?)  [["version", "20231103143711"]]
  TRANSACTION (0.7ms)  commit transaction
Migrating to CreatePets (20231103143728)
== 20231103143728 CreatePets: migrating =======================================
-- create_table(:pets)
  TRANSACTION (0.0ms)  begin transaction
   (0.5ms)  CREATE TABLE "pets" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "type" varchar, "pet_owner_id" integer NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_613b34c934"
FOREIGN KEY ("pet_owner_id")
  REFERENCES "pet_owners" ("id")
)
   (0.3ms)  CREATE INDEX "index_pets_on_pet_owner_id" ON "pets" ("pet_owner_id")
   -> 0.0029s
== 20231103143728 CreatePets: migrated (0.0029s) ==============================

  ActiveRecord::SchemaMigration Create (0.1ms)  INSERT INTO "schema_migrations" ("version") VALUES (?)  [["version", "20231103143728"]]
  TRANSACTION (0.7ms)  commit transaction
Migrating to CreateDogStuffs (20231103145430)
== 20231103145430 CreateDogStuffs: migrating ==================================
-- create_table(:dog_stuffs)
  TRANSACTION (0.0ms)  begin transaction
   (0.4ms)  CREATE TABLE "dog_stuffs" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "dog_id" integer NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_aebf607713"
FOREIGN KEY ("dog_id")
  REFERENCES "dogs" ("id")
)
   (0.1ms)  CREATE INDEX "index_dog_stuffs_on_dog_id" ON "dog_stuffs" ("dog_id")
   -> 0.0030s
== 20231103145430 CreateDogStuffs: migrated (0.0031s) =========================

  ActiveRecord::SchemaMigration Create (0.1ms)  INSERT INTO "schema_migrations" ("version") VALUES (?)  [["version", "20231103145430"]]
  TRANSACTION (0.8ms)  commit transaction
  ActiveRecord::InternalMetadata Load (0.1ms)  SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ?  [["key", "environment"], ["LIMIT", 1]]
  TRANSACTION (0.0ms)  begin transaction
  ActiveRecord::InternalMetadata Create (0.3ms)  INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?)  [["key", "environment"], ["value", "development"], ["created_at", "2023-11-08 16:55:18.333241"], ["updated_at", "2023-11-08 16:55:18.333241"]]
  TRANSACTION (1.0ms)  commit transaction
  ActiveRecord::SchemaMigration Pluck (0.1ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
Started GET "/" for ::1 at 2023-11-08 17:55:18 +0100
  ActiveRecord::SchemaMigration Pluck (0.1ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
Processing by Rails::WelcomeController#index as HTML
  Rendering /Users/stefano.savanelli/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.8/lib/rails/templates/rails/welcome/index.html.erb
  Rendered /Users/stefano.savanelli/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.8/lib/rails/templates/rails/welcome/index.html.erb (Duration: 1.2ms | Allocations: 286)
Completed 200 OK in 9ms (Views: 2.2ms | ActiveRecord: 0.0ms | Allocations: 2329)


Started GET "/motor_admin" for ::1 at 2023-11-08 17:55:31 +0100
Processing by Motor::UiController#show as HTML
   (1.6ms)  SELECT 'configs', MAX(updated_at) FROM "motor_configs" UNION SELECT 'resources', MAX(updated_at) FROM "motor_resources" UNION SELECT 'dashboards', MAX(updated_at) FROM "motor_dashboards" UNION SELECT 'alerts', MAX(updated_at) FROM "motor_alerts" UNION SELECT 'queries', MAX(updated_at) FROM "motor_queries" UNION SELECT 'forms', MAX(updated_at) FROM "motor_forms" UNION SELECT 'api_configs', MAX(updated_at) FROM "motor_api_configs"
  Motor::Config Load (0.2ms)  SELECT "motor_configs".* FROM "motor_configs"
  Rendering layout /Users/stefano.savanelli/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/motor-admin-0.4.22/app/views/layouts/motor/application.html.erb
  Rendering /Users/stefano.savanelli/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/motor-admin-0.4.22/app/views/motor/ui/show.html.erb within layouts/motor/application
  Motor::Audit Count (0.4ms)  SELECT COUNT(*) FROM "motor_audits"
  Motor::Resource Load (0.4ms)  SELECT "motor_resources".* FROM "motor_resources"
  Motor::Query Load (0.4ms)  SELECT "motor_queries".* FROM "motor_queries" WHERE "motor_queries"."deleted_at" IS NULL
  Motor::Dashboard Load (0.3ms)  SELECT "motor_dashboards".* FROM "motor_dashboards" WHERE "motor_dashboards"."deleted_at" IS NULL
  Motor::Alert Load (0.3ms)  SELECT "motor_alerts".* FROM "motor_alerts" WHERE "motor_alerts"."deleted_at" IS NULL
  Motor::Form Load (0.3ms)  SELECT "motor_forms".* FROM "motor_forms" WHERE "motor_forms"."deleted_at" IS NULL
  Rendered /Users/stefano.savanelli/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/motor-admin-0.4.22/app/views/motor/ui/show.html.erb within layouts/motor/application (Duration: 211.9ms | Allocations: 138163)
  Rendered layout /Users/stefano.savanelli/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/motor-admin-0.4.22/app/views/layouts/motor/application.html.erb (Duration: 246.6ms | Allocations: 152038)
Completed 200 OK in 302ms (Views: 244.2ms | ActiveRecord: 8.4ms | Allocations: 177863)


Started GET "/motor_admin/assets/main-13a7c05e5e481d3fe39b.css" for ::1 at 2023-11-08 17:55:31 +0100
Started GET "/motor_admin/assets/main-13a7c05e5e481d3fe39b.js" for ::1 at 2023-11-08 17:55:31 +0100
Started GET "/motor_admin/api/notifications?page%5Blimit%5D=0&page%5Boffset%5D=0&filter%5Bstatus%5D=pending&meta=count" for ::1 at 2023-11-08 17:55:32 +0100
Started GET "/motor_admin/assets/icons/database.svg" for ::1 at 2023-11-08 17:55:32 +0100
Processing by Motor::NotificationsController#index as HTML
  Parameters: {"page"=>{"limit"=>"0", "offset"=>"0"}, "filter"=>{"status"=>"pending"}, "meta"=>"count"}
  Motor::Notification Count (0.5ms)  SELECT COUNT(DISTINCT "motor_notifications"."id") FROM "motor_notifications" WHERE "motor_notifications"."recipient_id" IS NULL AND "motor_notifications"."status" = 'pending'
Started GET "/motor_admin/assets/fonts/ionicons-1a64b9a9a172d067c820.woff2" for ::1 at 2023-11-08 17:55:32 +0100
Completed 200 OK in 13ms (Views: 0.3ms | ActiveRecord: 1.4ms | Allocations: 3719)


Started GET "/motor_admin/cable" for ::1 at 2023-11-08 17:55:32 +0100
Started GET "/motor_admin/cable/" [WebSocket] for ::1 at 2023-11-08 17:55:32 +0100
Successfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: websocket)
Motor::NotificationsChannel is transmitting the subscription confirmation
Started GET "/motor_admin/api/data/pet_owners?fields%5Bpet_owner%5D=id%2Cname%2Cupdated_at%2Ccreated_at&page%5Blimit%5D=20&page%5Boffset%5D=0&sort=-id" for ::1 at 2023-11-08 17:55:34 +0100
Started GET "/motor_admin/api/data/pet_owners?fields%5Bpet_owner%5D=id%2Cname%2Cupdated_at%2Ccreated_at&page%5Blimit%5D=0&sort=-id&meta=count" for ::1 at 2023-11-08 17:55:34 +0100
Processing by Motor::DataController#index as HTML
  Parameters: {"fields"=>{"pet_owner"=>"id,name,updated_at,created_at"}, "page"=>{"limit"=>"20", "offset"=>"0"}, "sort"=>"-id", "resource"=>"pet_owners"}
  Motor::Resource Maximum (0.2ms)  SELECT MAX("motor_resources"."updated_at") FROM "motor_resources"
  Motor::Resource Load (0.1ms)  SELECT "motor_resources".* FROM "motor_resources"
  CACHE Motor::Resource Load (0.0ms)  SELECT "motor_resources".* FROM "motor_resources"
  CACHE Motor::Resource Load (0.0ms)  SELECT "motor_resources".* FROM "motor_resources"
  CACHE Motor::Resource Load (0.0ms)  SELECT "motor_resources".* FROM "motor_resources"
  CACHE Motor::Resource Load (0.0ms)  SELECT "motor_resources".* FROM "motor_resources"
  PetOwner Load (0.5ms)  SELECT "pet_owners".* FROM "pet_owners" ORDER BY "pet_owners"."id" DESC LIMIT ? OFFSET ?  [["LIMIT", 20], ["OFFSET", 0]]
Completed 200 OK in 24ms (Views: 0.1ms | ActiveRecord: 0.8ms | Allocations: 13340)


Processing by Motor::DataController#index as HTML
  Parameters: {"fields"=>{"pet_owner"=>"id,name,updated_at,created_at"}, "page"=>{"limit"=>"0"}, "sort"=>"-id", "meta"=>"count", "resource"=>"pet_owners"}
  Motor::Resource Maximum (0.1ms)  SELECT MAX("motor_resources"."updated_at") FROM "motor_resources"
  Motor::Resource Load (0.1ms)  SELECT "motor_resources".* FROM "motor_resources"
  PetOwner Count (0.2ms)  SELECT COUNT("pet_owners"."id") FROM "pet_owners"
Completed 200 OK in 7ms (Views: 0.1ms | ActiveRecord: 0.4ms | Allocations: 3820)


Started POST "/motor_admin/api/data/pet_owners" for ::1 at 2023-11-08 17:55:43 +0100
Processing by Motor::DataController#create as HTML
  Parameters: {"data"=>{"name"=>"John"}, "resource"=>"pet_owners"}
  Motor::Resource Maximum (0.1ms)  SELECT MAX("motor_resources"."updated_at") FROM "motor_resources"
  Motor::Resource Load (0.1ms)  SELECT "motor_resources".* FROM "motor_resources"
  TRANSACTION (0.1ms)  begin transaction
  PetOwner Create (0.8ms)  INSERT INTO "pet_owners" ("name", "created_at", "updated_at") VALUES (?, ?, ?)  [["name", "John"], ["created_at", "2023-11-08 16:55:43.952538"], ["updated_at", "2023-11-08 16:55:43.952538"]]
  Motor::Audit Create (1.2ms)  INSERT INTO "motor_audits" ("auditable_id", "auditable_type", "associated_id", "associated_type", "user_id", "user_type", "username", "action", "audited_changes", "version", "comment", "remote_address", "request_uuid", "created_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)  [["auditable_id", "1"], ["auditable_type", "PetOwner"], ["associated_id", nil], ["associated_type", nil], ["user_id", nil], ["user_type", nil], ["username", nil], ["action", "create"], ["audited_changes", "{\"name\":\"John\"}"], ["version", 1], ["comment", nil], ["remote_address", "::1"], ["request_uuid", "7bd3fd9c-b819-4d2a-b47a-0ec42b315092"], ["created_at", "2023-11-08 16:55:43.988738"]]
  TRANSACTION (1.3ms)  commit transaction
Completed 200 OK in 46ms (Views: 0.1ms | ActiveRecord: 3.4ms | Allocations: 29529)


Started GET "/motor_admin/api/data/pet_owners?fields%5Bpet_owner%5D=id%2Cname%2Cupdated_at%2Ccreated_at&page%5Blimit%5D=20&page%5Boffset%5D=0&sort=-id" for ::1 at 2023-11-08 17:55:44 +0100
Started GET "/motor_admin/api/data/pet_owners?fields%5Bpet_owner%5D=id%2Cname%2Cupdated_at%2Ccreated_at&page%5Blimit%5D=0&sort=-id&meta=count" for ::1 at 2023-11-08 17:55:44 +0100
Processing by Motor::DataController#index as HTML
  Parameters: {"fields"=>{"pet_owner"=>"id,name,updated_at,created_at"}, "page"=>{"limit"=>"20", "offset"=>"0"}, "sort"=>"-id", "resource"=>"pet_owners"}
  Motor::Resource Maximum (0.1ms)  SELECT MAX("motor_resources"."updated_at") FROM "motor_resources"
  Motor::Resource Load (0.1ms)  SELECT "motor_resources".* FROM "motor_resources"
  PetOwner Load (0.1ms)  SELECT "pet_owners".* FROM "pet_owners" ORDER BY "pet_owners"."id" DESC LIMIT ? OFFSET ?  [["LIMIT", 20], ["OFFSET", 0]]
Completed 200 OK in 7ms (Views: 0.2ms | ActiveRecord: 0.3ms | Allocations: 3902)


Processing by Motor::DataController#index as HTML
  Parameters: {"fields"=>{"pet_owner"=>"id,name,updated_at,created_at"}, "page"=>{"limit"=>"0"}, "sort"=>"-id", "meta"=>"count", "resource"=>"pet_owners"}
  Motor::Resource Maximum (0.1ms)  SELECT MAX("motor_resources"."updated_at") FROM "motor_resources"
  Motor::Resource Load (0.1ms)  SELECT "motor_resources".* FROM "motor_resources"
  PetOwner Count (0.1ms)  SELECT COUNT("pet_owners"."id") FROM "pet_owners"
Completed 200 OK in 7ms (Views: 0.1ms | ActiveRecord: 0.3ms | Allocations: 3788)


Started GET "/motor_admin/api/data/cats?fields%5Bcat%5D=id%2Cpet_owner_id%2Cname%2Ctype%2Cupdated_at%2Ccreated_at&fields%5Bpet_owner%5D=id%2Cname%2Cupdated_at%2Ccreated_at&page%5Blimit%5D=20&page%5Boffset%5D=0&sort=-id&include=pet_owner" for ::1 at 2023-11-08 17:55:45 +0100
Started GET "/motor_admin/api/data/cats?fields%5Bcat%5D=id%2Cpet_owner_id%2Cname%2Ctype%2Cupdated_at%2Ccreated_at&fields%5Bpet_owner%5D=id%2Cname%2Cupdated_at%2Ccreated_at&page%5Blimit%5D=0&sort=-id&include=pet_owner&meta=count" for ::1 at 2023-11-08 17:55:45 +0100
Processing by Motor::DataController#index as HTML
  Parameters: {"fields"=>{"cat"=>"id,pet_owner_id,name,type,updated_at,created_at", "pet_owner"=>"id,name,updated_at,created_at"}, "page"=>{"limit"=>"20", "offset"=>"0"}, "sort"=>"-id", "include"=>"pet_owner", "resource"=>"cats"}
  Motor::Resource Maximum (0.3ms)  SELECT MAX("motor_resources"."updated_at") FROM "motor_resources"
  Motor::Resource Load (0.1ms)  SELECT "motor_resources".* FROM "motor_resources"
  Cat Load (0.5ms)  SELECT "pets".* FROM "pets" WHERE "pets"."type" = ? ORDER BY "pets"."id" DESC LIMIT ? OFFSET ?  [["type", "Cat"], ["LIMIT", 20], ["OFFSET", 0]]
Completed 200 OK in 11ms (Views: 0.3ms | ActiveRecord: 0.9ms | Allocations: 4037)


Processing by Motor::DataController#index as HTML
  Parameters: {"fields"=>{"cat"=>"id,pet_owner_id,name,type,updated_at,created_at", "pet_owner"=>"id,name,updated_at,created_at"}, "page"=>{"limit"=>"0"}, "sort"=>"-id", "include"=>"pet_owner", "meta"=>"count", "resource"=>"cats"}
  Motor::Resource Maximum (0.2ms)  SELECT MAX("motor_resources"."updated_at") FROM "motor_resources"
  Motor::Resource Load (0.2ms)  SELECT "motor_resources".* FROM "motor_resources"
  Cat Count (0.2ms)  SELECT COUNT("pets"."id") FROM "pets" WHERE "pets"."type" = ?  [["type", "Cat"]]
Completed 200 OK in 12ms (Views: 0.2ms | ActiveRecord: 0.6ms | Allocations: 3918)


Started GET "/motor_admin/api/data/pet_owners?q=&fields%5Bpet_owner%5D=id%2Cname%2Cupdated_at%2Ccreated_at&page%5Blimit%5D=100" for ::1 at 2023-11-08 17:55:47 +0100
Processing by Motor::DataController#index as HTML
  Parameters: {"q"=>"", "fields"=>{"pet_owner"=>"id,name,updated_at,created_at"}, "page"=>{"limit"=>"100"}, "resource"=>"pet_owners"}
  Motor::Resource Maximum (0.1ms)  SELECT MAX("motor_resources"."updated_at") FROM "motor_resources"
  Motor::Resource Load (0.1ms)  SELECT "motor_resources".* FROM "motor_resources"
  PetOwner Load (0.2ms)  SELECT "pet_owners".* FROM "pet_owners" LIMIT ? OFFSET ?  [["LIMIT", 100], ["OFFSET", 0]]
Completed 200 OK in 6ms (Views: 0.1ms | ActiveRecord: 0.4ms | Allocations: 3842)


Started POST "/motor_admin/api/data/cats" for ::1 at 2023-11-08 17:55:52 +0100
Processing by Motor::DataController#create as HTML
  Parameters: {"data"=>{"pet_owner_id"=>1, "name"=>"Mao", "type"=>"Cat"}, "resource"=>"cats"}
  Motor::Resource Maximum (0.1ms)  SELECT MAX("motor_resources"."updated_at") FROM "motor_resources"
  Motor::Resource Load (0.1ms)  SELECT "motor_resources".* FROM "motor_resources"
  TRANSACTION (0.1ms)  begin transaction
  PetOwner Load (0.1ms)  SELECT "pet_owners".* FROM "pet_owners" WHERE "pet_owners"."id" = ? LIMIT ?  [["id", 1], ["LIMIT", 1]]
  Cat Create (0.9ms)  INSERT INTO "pets" ("name", "type", "pet_owner_id", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?)  [["name", "Mao"], ["type", "Cat"], ["pet_owner_id", 1], ["created_at", "2023-11-08 16:55:52.931116"], ["updated_at", "2023-11-08 16:55:52.931116"]]
  TRANSACTION (0.7ms)  commit transaction
Completed 200 OK in 12ms (Views: 0.1ms | ActiveRecord: 2.0ms | Allocations: 8872)


Started GET "/motor_admin/api/data/cats?fields%5Bcat%5D=id%2Cpet_owner_id%2Cname%2Ctype%2Cupdated_at%2Ccreated_at&fields%5Bpet_owner%5D=id%2Cname%2Cupdated_at%2Ccreated_at&page%5Blimit%5D=20&page%5Boffset%5D=0&sort=-id&include=pet_owner" for ::1 at 2023-11-08 17:55:52 +0100
Started GET "/motor_admin/api/data/cats?fields%5Bcat%5D=id%2Cpet_owner_id%2Cname%2Ctype%2Cupdated_at%2Ccreated_at&fields%5Bpet_owner%5D=id%2Cname%2Cupdated_at%2Ccreated_at&page%5Blimit%5D=0&sort=-id&include=pet_owner&meta=count" for ::1 at 2023-11-08 17:55:52 +0100
Processing by Motor::DataController#index as HTML
  Parameters: {"fields"=>{"cat"=>"id,pet_owner_id,name,type,updated_at,created_at", "pet_owner"=>"id,name,updated_at,created_at"}, "page"=>{"limit"=>"20", "offset"=>"0"}, "sort"=>"-id", "include"=>"pet_owner", "resource"=>"cats"}
  Motor::Resource Maximum (0.2ms)  SELECT MAX("motor_resources"."updated_at") FROM "motor_resources"
  Motor::Resource Load (0.1ms)  SELECT "motor_resources".* FROM "motor_resources"
  Cat Load (0.2ms)  SELECT "pets".* FROM "pets" WHERE "pets"."type" = ? ORDER BY "pets"."id" DESC LIMIT ? OFFSET ?  [["type", "Cat"], ["LIMIT", 20], ["OFFSET", 0]]
  PetOwner Load (0.2ms)  SELECT "pet_owners".* FROM "pet_owners" WHERE "pet_owners"."id" = ?  [["id", 1]]
Completed 200 OK in 16ms (Views: 0.2ms | ActiveRecord: 0.7ms | Allocations: 6326)


Processing by Motor::DataController#index as HTML
  Parameters: {"fields"=>{"cat"=>"id,pet_owner_id,name,type,updated_at,created_at", "pet_owner"=>"id,name,updated_at,created_at"}, "page"=>{"limit"=>"0"}, "sort"=>"-id", "include"=>"pet_owner", "meta"=>"count", "resource"=>"cats"}
  Motor::Resource Maximum (0.2ms)  SELECT MAX("motor_resources"."updated_at") FROM "motor_resources"
  Motor::Resource Load (0.1ms)  SELECT "motor_resources".* FROM "motor_resources"
  Cat Count (0.2ms)  SELECT COUNT("pets"."id") FROM "pets" WHERE "pets"."type" = ?  [["type", "Cat"]]
Completed 200 OK in 7ms (Views: 0.2ms | ActiveRecord: 0.5ms | Allocations: 3879)


Started GET "/motor_admin/api/data/pets?fields%5Bpet%5D=id%2Cpet_owner_id%2Cname%2Ctype%2Cupdated_at%2Ccreated_at&fields%5Bpet_owner%5D=id%2Cname%2Cupdated_at%2Ccreated_at&page%5Blimit%5D=20&page%5Boffset%5D=0&sort=-id&include=pet_owner" for ::1 at 2023-11-08 17:55:55 +0100
Started GET "/motor_admin/api/data/pets?fields%5Bpet%5D=id%2Cpet_owner_id%2Cname%2Ctype%2Cupdated_at%2Ccreated_at&fields%5Bpet_owner%5D=id%2Cname%2Cupdated_at%2Ccreated_at&page%5Blimit%5D=0&sort=-id&include=pet_owner&meta=count" for ::1 at 2023-11-08 17:55:55 +0100
Processing by Motor::DataController#index as HTML
  Parameters: {"fields"=>{"pet"=>"id,pet_owner_id,name,type,updated_at,created_at", "pet_owner"=>"id,name,updated_at,created_at"}, "page"=>{"limit"=>"20", "offset"=>"0"}, "sort"=>"-id", "include"=>"pet_owner", "resource"=>"pets"}
  Motor::Resource Maximum (0.1ms)  SELECT MAX("motor_resources"."updated_at") FROM "motor_resources"
  Motor::Resource Load (0.1ms)  SELECT "motor_resources".* FROM "motor_resources"
  Pet Load (0.1ms)  SELECT "pets".* FROM "pets" WHERE "pets"."type" = ? ORDER BY "pets"."id" DESC LIMIT ? OFFSET ?  [["type", "Pet"], ["LIMIT", 20], ["OFFSET", 0]]
Completed 200 OK in 9ms (Views: 0.3ms | ActiveRecord: 0.4ms | Allocations: 4096)


Processing by Motor::DataController#index as HTML
  Parameters: {"fields"=>{"pet"=>"id,pet_owner_id,name,type,updated_at,created_at", "pet_owner"=>"id,name,updated_at,created_at"}, "page"=>{"limit"=>"0"}, "sort"=>"-id", "include"=>"pet_owner", "meta"=>"count", "resource"=>"pets"}
  Motor::Resource Maximum (0.2ms)  SELECT MAX("motor_resources"."updated_at") FROM "motor_resources"
  Motor::Resource Load (0.6ms)  SELECT "motor_resources".* FROM "motor_resources"
  Pet Count (0.3ms)  SELECT COUNT("pets"."id") FROM "pets" WHERE "pets"."type" = ?  [["type", "Pet"]]
Completed 200 OK in 9ms (Views: 0.2ms | ActiveRecord: 1.0ms | Allocations: 3918)

Now I touch Pet resource configuration ...

Started POST "/motor_admin/api/resources" for ::1 at 2023-11-08 17:57:17 +0100
Started GET "/motor_admin/api/data/pets?fields%5Bpet%5D=id%2Cname%2Ctype%2Cupdated_at%2Ccreated_at&page%5Blimit%5D=20&page%5Boffset%5D=0&sort=-id" for ::1 at 2023-11-08 17:57:17 +0100
Processing by Motor::DataController#index as HTML
  Parameters: {"fields"=>{"pet"=>"id,name,type,updated_at,created_at"}, "page"=>{"limit"=>"20", "offset"=>"0"}, "sort"=>"-id", "resource"=>"pets"}
  Motor::Resource Maximum (0.6ms)  SELECT MAX("motor_resources"."updated_at") FROM "motor_resources"
  Motor::Resource Load (0.2ms)  SELECT "motor_resources".* FROM "motor_resources"
  Pet Load (0.1ms)  SELECT "pets".* FROM "pets" WHERE "pets"."type" = ? ORDER BY "pets"."id" DESC LIMIT ? OFFSET ?  [["type", "Pet"], ["LIMIT", 20], ["OFFSET", 0]]
Completed 200 OK in 134ms (Views: 3.4ms | ActiveRecord: 0.9ms | Allocations: 3994)


Processing by Motor::ResourcesController#create as HTML
  Parameters: {"data"=>{"name"=>"pet", "preferences"=>{"columns"=>[{"name"=>"pet_owner_id", "display_name"=>"Pet owner", "column_type"=>"reference", "column_source"=>"table", "access_type"=>"hidden", "default_value"=>nil, "validators"=>[{"required"=>true}], "format"=>{}, "reference"=>{"name"=>"pet_owner", "display_name"=>"Pet owner", "model_name"=>"pet_owner", "reference_type"=>"belongs_to", "foreign_key"=>"[FILTERED]", "primary_key"=>"[FILTERED]", "options"=>{}, "polymorphic"=>nil, "virtual"=>false}, "virtual"=>false, "_update"=>"pet_owner_id"}]}}}
  Motor::Resource Load (0.2ms)  SELECT "motor_resources".* FROM "motor_resources" WHERE "motor_resources"."name" = ? LIMIT ?  [["name", "pet"], ["LIMIT", 1]]
  TRANSACTION (0.1ms)  begin transaction
  Motor::Resource Create (0.7ms)  INSERT INTO "motor_resources" ("name", "preferences", "created_at", "updated_at") VALUES (?, ?, ?, ?)  [["name", "pet"], ["preferences", "{\"columns\":[{\"access_type\":\"hidden\",\"reference\":{\"name\":\"pet_owner\",\"display_name\":\"Pet owner\",\"model_name\":\"pet_owner\",\"reference_type\":\"belongs_to\",\"foreign_key\":\"pet_owner_id\",\"primary_key\":\"id\",\"options\":{},\"polymorphic\":null,\"virtual\":false},\"name\":\"pet_owner_id\"}]}"], ["created_at", "2023-11-08 16:57:18.241307"], ["updated_at", "2023-11-08 16:57:18.241307"]]
  Motor::Audit Create (0.6ms)  INSERT INTO "motor_audits" ("auditable_id", "auditable_type", "associated_id", "associated_type", "user_id", "user_type", "username", "action", "audited_changes", "version", "comment", "remote_address", "request_uuid", "created_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)  [["auditable_id", "1"], ["auditable_type", "Motor::Resource"], ["associated_id", nil], ["associated_type", nil], ["user_id", nil], ["user_type", nil], ["username", nil], ["action", "create"], ["audited_changes", "{\"name\":\"pet\",\"preferences\":{\"columns\":[{\"access_type\":\"hidden\",\"reference\":{\"name\":\"pet_owner\",\"display_name\":\"Pet owner\",\"model_name\":\"pet_owner\",\"reference_type\":\"belongs_to\",\"foreign_key\":\"pet_owner_id\",\"primary_key\":\"id\",\"options\":{},\"polymorphic\":null,\"virtual\":false},\"name\":\"pet_owner_id\"}]}}"], ["version", 1], ["comment", nil], ["remote_address", "::1"], ["request_uuid", "eac5ac60-36f4-409b-9a36-796d602120a8"], ["created_at", "2023-11-08 16:57:18.253500"]]
  TRANSACTION (1.2ms)  commit transaction
Completed 200 OK in 38ms (Views: 0.3ms | ActiveRecord: 3.7ms | Allocations: 12214)


Started POST "/motor_admin/api/resources" for ::1 at 2023-11-08 17:57:19 +0100
Processing by Motor::ResourcesController#create as HTML
  Parameters: {"data"=>{"name"=>"pet", "preferences"=>{"columns"=>[{"name"=>"pet_owner_id", "display_name"=>"Pet owner", "column_type"=>"reference", "column_source"=>"table", "access_type"=>"read_write", "default_value"=>nil, "validators"=>[{"required"=>true}], "format"=>{}, "reference"=>{"name"=>"pet_owner", "display_name"=>"Pet owner", "model_name"=>"pet_owner", "reference_type"=>"belongs_to", "foreign_key"=>"[FILTERED]", "primary_key"=>"[FILTERED]", "options"=>{}, "polymorphic"=>nil, "virtual"=>false}, "virtual"=>false, "_update"=>"pet_owner_id"}]}}}
  Motor::Resource Load (0.1ms)  SELECT "motor_resources".* FROM "motor_resources" WHERE "motor_resources"."name" = ? LIMIT ?  [["name", "pet"], ["LIMIT", 1]]
  TRANSACTION (0.0ms)  begin transaction
  Motor::Audit Maximum (0.2ms)  SELECT MAX("motor_audits"."version") FROM "motor_audits" WHERE "motor_audits"."auditable_id" = ? AND "motor_audits"."auditable_type" = ?  [["auditable_id", "1"], ["auditable_type", "Motor::Resource"]]
  Motor::Audit Create (0.6ms)  INSERT INTO "motor_audits" ("auditable_id", "auditable_type", "associated_id", "associated_type", "user_id", "user_type", "username", "action", "audited_changes", "version", "comment", "remote_address", "request_uuid", "created_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)  [["auditable_id", "1"], ["auditable_type", "Motor::Resource"], ["associated_id", nil], ["associated_type", nil], ["user_id", nil], ["user_type", nil], ["username", nil], ["action", "update"], ["audited_changes", "{\"preferences\":[{\"columns\":[{\"access_type\":\"hidden\",\"reference\":{\"name\":\"pet_owner\",\"display_name\":\"Pet owner\",\"model_name\":\"pet_owner\",\"reference_type\":\"belongs_to\",\"foreign_key\":\"pet_owner_id\",\"primary_key\":\"id\",\"options\":{},\"polymorphic\":null,\"virtual\":false},\"name\":\"pet_owner_id\"}]},{\"columns\":[{\"reference\":{\"name\":\"pet_owner\",\"display_name\":\"Pet owner\",\"model_name\":\"pet_owner\",\"reference_type\":\"belongs_to\",\"foreign_key\":\"pet_owner_id\",\"primary_key\":\"id\",\"options\":{},\"polymorphic\":null,\"virtual\":false},\"name\":\"pet_owner_id\"}]}]}"], ["version", 2], ["comment", nil], ["remote_address", "::1"], ["request_uuid", "8268b2d0-3fcf-4c4c-849b-a6cf032783d3"], ["created_at", "2023-11-08 16:57:19.087660"]]
  Motor::Resource Update (0.2ms)  UPDATE "motor_resources" SET "preferences" = ?, "updated_at" = ? WHERE "motor_resources"."id" = ?  [["preferences", "{\"columns\":[{\"reference\":{\"name\":\"pet_owner\",\"display_name\":\"Pet owner\",\"model_name\":\"pet_owner\",\"reference_type\":\"belongs_to\",\"foreign_key\":\"pet_owner_id\",\"primary_key\":\"id\",\"options\":{},\"polymorphic\":null,\"virtual\":false},\"name\":\"pet_owner_id\"}]}"], ["updated_at", "2023-11-08 16:57:19.086353"], ["id", 1]]
  TRANSACTION (1.4ms)  commit transaction
Completed 200 OK in 27ms (Views: 0.3ms | ActiveRecord: 3.2ms | Allocations: 13716)


Started GET "/motor_admin/api/data/pets?fields%5Bpet%5D=id%2Cpet_owner_id%2Cname%2Ctype%2Cupdated_at%2Ccreated_at&fields%5Bpet_owner%5D=id%2Cname%2Cupdated_at%2Ccreated_at&page%5Blimit%5D=20&page%5Boffset%5D=0&sort=-id&include=pet_owner" for ::1 at 2023-11-08 17:57:20 +0100
Processing by Motor::DataController#index as HTML
  Parameters: {"fields"=>{"pet"=>"id,pet_owner_id,name,type,updated_at,created_at", "pet_owner"=>"id,name,updated_at,created_at"}, "page"=>{"limit"=>"20", "offset"=>"0"}, "sort"=>"-id", "include"=>"pet_owner", "resource"=>"pets"}
  Motor::Resource Maximum (0.2ms)  SELECT MAX("motor_resources"."updated_at") FROM "motor_resources"
  Motor::Resource Load (0.2ms)  SELECT "motor_resources".* FROM "motor_resources"
  Pet Load (0.2ms)  SELECT "pets".* FROM "pets" ORDER BY "pets"."id" DESC LIMIT ? OFFSET ?  [["LIMIT", 20], ["OFFSET", 0]]
  PetOwner Load (0.2ms)  SELECT "pet_owners".* FROM "pet_owners" WHERE "pet_owners"."id" = ?  [["id", 1]]
Completed 200 OK in 25ms (Views: 0.6ms | ActiveRecord: 0.8ms | Allocations: 13576)

@omohokcoj
Copy link
Member

@stefsava @bruno-berchielli supporting STI is not a goal in motor admin (STI is sometimes considered and antipattern and can be replaced with simple models). Though, PR's are welcomed if someone wants to work on this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants