Comments (5)
@Frexuz there should be an error message regarding this model in your rails server stdout after you try to load the motor admin UI for the first time after boot.
At first glance the model looks good - idk what unique_token_options
does - maybe it breaks the model
from motor-admin-rails.
Thanks for the help :)
This? 🤔 That's the :status
enum on the Matter
model
translation data {:assessment_started=>"Assessment started", :completed=>"Completed", :delivered=>"Package delivered", :delivery_sent=>"Package sent", :paid=>"Paid", :pending_assessor=>"Waiting for assessor", :pending_info=>"Waiting for case information", :pending_payment=>"Waiting for payment"} can not be used with :count => 1. key 'one' is missing.
Full output
19:55:40 web.1 | Started GET "/motor_admin/cable" for ::1 at 2023-05-20 19:55:40 +0800
19:55:40 web.1 | Started GET "/motor_admin/cable/" [WebSocket] for ::1 at 2023-05-20 19:55:40 +0800
19:55:40 web.1 | Successfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: websocket)
19:55:40 web.1 | Motor::NotificationsChannel is transmitting the subscription confirmation
19:55:41 web.1 | Started GET "/motor_admin/" for ::1 at 2023-05-20 19:55:41 +0800
19:55:41 web.1 | Processing by Motor::UiController#show as HTML
19:55:41 web.1 | SQL (12.8ms) 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"
19:55:41 web.1 | Motor::Config Load (0.2ms) SELECT "motor_configs".* FROM "motor_configs"
19:55:41 web.1 | TRANSACTION (0.1ms) BEGIN
19:55:41 web.1 | Motor::Query Load (0.3ms) SELECT "motor_queries".* FROM "motor_queries" WHERE "motor_queries"."deleted_at" IS NULL
19:55:41 web.1 | Motor::Alert Load (0.3ms) SELECT "motor_alerts".* FROM "motor_alerts" WHERE "motor_alerts"."deleted_at" IS NULL
19:55:41 web.1 | Motor::Dashboard Load (0.2ms) SELECT "motor_dashboards".* FROM "motor_dashboards" WHERE "motor_dashboards"."deleted_at" IS NULL
19:55:41 web.1 | Motor::Form Load (0.2ms) SELECT "motor_forms".* FROM "motor_forms" WHERE "motor_forms"."deleted_at" IS NULL
19:55:41 web.1 | CACHE Motor::Config Load (0.0ms) SELECT "motor_configs".* FROM "motor_configs"
19:55:41 web.1 | Motor::Resource Load (0.2ms) SELECT "motor_resources".* FROM "motor_resources"
19:55:41 web.1 | Motor::ApiConfig Load (0.2ms) SELECT "motor_api_configs".* FROM "motor_api_configs" WHERE "motor_api_configs"."deleted_at" IS NULL
19:55:41 web.1 | TRANSACTION (1.4ms) COMMIT
19:55:41 web.1 | Rendering layout /Users/frexuz/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/motor-admin-0.4.11/app/views/layouts/motor/application.html.erb
19:55:41 web.1 | Rendering /Users/frexuz/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/motor-admin-0.4.11/app/views/motor/ui/show.html.erb within layouts/motor/application
19:55:41 web.1 | Motor::Audit Count (2.6ms) SELECT COUNT(*) FROM "motor_audits"
19:55:41 web.1 | translation data {:assessment_started=>"Assessment started", :completed=>"Completed", :delivered=>"Package delivered", :delivery_sent=>"Package sent", :paid=>"Paid", :pending_assessor=>"Waiting for assessor", :pending_info=>"Waiting for case information", :pending_payment=>"Waiting for payment"} can not be used with :count => 1. key 'one' is missing.
19:55:41 web.1 | CACHE Motor::Resource Load (0.0ms) SELECT "motor_resources".* FROM "motor_resources"
19:55:41 web.1 | CACHE Motor::Query Load (0.0ms) SELECT "motor_queries".* FROM "motor_queries" WHERE "motor_queries"."deleted_at" IS NULL
19:55:41 web.1 | CACHE Motor::Dashboard Load (0.0ms) SELECT "motor_dashboards".* FROM "motor_dashboards" WHERE "motor_dashboards"."deleted_at" IS NULL
19:55:41 web.1 | CACHE Motor::Alert Load (0.0ms) SELECT "motor_alerts".* FROM "motor_alerts" WHERE "motor_alerts"."deleted_at" IS NULL
19:55:41 web.1 | CACHE Motor::Form Load (0.0ms) SELECT "motor_forms".* FROM "motor_forms" WHERE "motor_forms"."deleted_at" IS NULL
19:55:41 web.1 | Rendered /Users/frexuz/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/motor-admin-0.4.11/app/views/motor/ui/show.html.erb within layouts/motor/application (Duration: 364.5ms | Allocations: 521912)
19:55:41 web.1 | Rendered layout /Users/frexuz/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/motor-admin-0.4.11/app/views/layouts/motor/application.html.erb (Duration: 382.9ms | Allocations: 534961)
19:55:41 web.1 | Completed 200 OK in 499ms (Views: 318.3ms | ActiveRecord: 132.3ms | Allocations: 589139)
19:55:41 web.1 |
19:55:41 web.1 |
19:55:41 web.1 | Finished "/motor_admin/cable/" [WebSocket] for ::1 at 2023-05-20 19:55:41 +0800
19:55:41 web.1 | Started GET "/motor_admin/cable" for ::1 at 2023-05-20 19:55:41 +0800
19:55:41 web.1 | Started GET "/motor_admin/api/notifications?page%5Blimit%5D=0&page%5Boffset%5D=0&filter%5Bstatus%5D=pending&meta=count" for ::1 at 2023-05-20 19:55:41 +0800
19:55:41 web.1 | Started GET "/motor_admin/cable/" [WebSocket] for ::1 at 2023-05-20 19:55:41 +0800
19:55:41 web.1 | Successfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: websocket)
19:55:41 web.1 | Processing by Motor::NotificationsController#index as HTML
19:55:41 web.1 | Parameters: {"page"=>{"limit"=>"0", "offset"=>"0"}, "filter"=>{"status"=>"pending"}, "meta"=>"count"}
19:55:41 web.1 | Motor::Notification Count (1.2ms) SELECT COUNT(DISTINCT "motor_notifications"."id") FROM "motor_notifications" WHERE "motor_notifications"."recipient_id" IS NULL AND "motor_notifications"."status" = 'pending'
19:55:41 web.1 | Completed 200 OK in 11ms (Views: 0.1ms | ActiveRecord: 6.5ms | Allocations: 4191)
19:55:41 web.1 |
19:55:41 web.1 |
19:55:41 web.1 | Motor::NotificationsChannel is transmitting the subscription confirmation
from motor-admin-rails.
FYI, I do have translations for that model:
---
en:
activerecord:
attributes:
matter:
status:
assessment_started: Assessment started
completed: Completed
delivered: Package delivered
delivery_sent: Package sent
paid: Paid
pending_assessor: Waiting for assessor
pending_info: Waiting for case information
pending_payment: Waiting for payment
What is it trying to translate, and whats the expected output?
from motor-admin-rails.
Added the one
key to the translations just to test. Getting this:
---
en:
activerecord:
attributes:
matter:
one: Matter
other: Matters
status:
assessment_started: Assessment started
completed: Completed
delivered: Package delivered
delivery_sent: Package sent
one: One key <----------------------------------------------
paid: Paid
pending_assessor: Waiting for assessor
pending_info: Waiting for case information
pending_payment: Waiting for payment
Why is the 'one' key required? That's not needed in standard rails. You should check if the key is defined, and fallback to the default column text output
Looks like a motor bug to me
from motor-admin-rails.
@Frexuz i think i figured out what happened here:
You added enum status name keys into 'activerecord.attributes.matter.status' i18n hash
The problem is that it breaks the rails convention for i18n - 'activerecord.attributes.matter.status' should contain a string (AR model attr name) or a hash with One/Two/Many keys (also for AR model attrs).
So basically storing enum keys i18n in 'activerecord.attributes.matter.status' was a bad idea since it breaks rails convention.
It would be best to move those keys elsewhere - lets' say into 'enums.matter.status'
Closing this ticket since motor admin is built mostly on top of rails conventions which should be followed (handling edge cases which violate rails conventions is not a goal)
from motor-admin-rails.
Related Issues (20)
- Custom form: multiple select field not being populated on initial data load HOT 4
- Inline editing is still enabled even the edit action is disabled HOT 4
- Weird issues with polymorphic fields HOT 8
- Motor migrations fail rails_best_practices static checks HOT 1
- Define API endpoint for Form HOT 1
- Unable to set Read-Only for File column HOT 1
- Defining postgres schemas not working
- Handling authorization for non-admin users HOT 1
- Issues with Rodauth HOT 1
- found unpermitted parameters: :name, :tags when constructing new query HOT 4
- Update of json field failed HOT 1
- CanCanCan Permissions not applies! HOT 3
- Application is freezing on MUTEX.sinchronize HOT 2
- Save custom scopes in the database HOT 1
- Boolean fields submitting nil instead of false HOT 2
- MySQL blank screen - Pie Chart - percent format
- Error when creating association
- API endpoint Form submitting table data when used in action
- Breakage when copying headers from API request response to the MA app response HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from motor-admin-rails.