Comments (1)
Thank you for raising this. My current impression is that this cannot be avoided automatically, and it's on Administrate users to ensure that these relationships are loaded correctly. After all, that's generally the case when strict loading is in effect.
Fortunately, the fix should be straightforward: eager load the appropriate relationships, for example using the scoped_resource
hook.
I have an example app where Thing.has_many :parts
. To avoid this issue, I added the following lines:
# app/controllers/admin/things_controller.rb
...
def scoped_resource
super.includes(:parts)
end
...
And:
# app/controllers/admin/parts_controller.rb
...
def scoped_resource
super.includes(:thing)
end
...
Now the relationship is loaded explicitly and will not cause an issue when strict loading.
I'm going to close this now, but please do let use know if you have any feedback.
from administrate.
Related Issues (20)
- Will v1.0.0 provide built-in support for Active Storage and Action Text? HOT 1
- Handling of scoped dynamic routes HOT 2
- Upgrade to v1 breaks with applications using Bootstrap 4.6 HOT 11
- Flakey spec: Search admin search with a filter with arguments HOT 1
- Cannot see the value of most fields in edit forms unless you mouseover them (1.0.0.beta1) HOT 2
- Selectize removes the blank options from selects HOT 1
- How to type an attribute that returns a model but doesn't use a has_one association HOT 1
- generator `administrate:install` fails if ActionCable is disabled HOT 6
- White Font Color in Text Input Box on demo site HOT 3
- the has_one looks different in edit page HOT 1
- In title on object creation form name of object showing in plural form
- view variants support
- Field::HasMany loading too many records in Edit view
- Field Select - Default selected option not working
- One model, two dashboards HOT 1
- Potential peformance improvements with Field::BelongsTo
- Is it possible to not require the image_processing gem?
- Snakecased routes not being properly generate on show pages of resources
- PG::DuplicatePstatement: ERROR: prepared statement already exists
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 administrate.