activeadmin


ActiveAdmin limiting has_many association retrieval?


Hi this is my first spin with active admin, I have the two models:
Patient
Attributes
Where a Patient has_many Attributes
I created a patient resource like this:
rails g active_admin:resource patient
It seemed to work fine, however: the query active admin is creating:
Patient Load (0.9ms) SELECT "patient".* FROM "patient" ORDER BY "patient"."id" desc LIMIT 30 OFFSET 0
Attribute Load (1878.2ms) SELECT "attributes".* FROM "attributes"
The problem is with the second one, because I have about 200 000 Attributes so SELECT * "attributes" is killing my computer.
I've been looking for an hour on how to limit the second query. Any help is appreciated. Thanks.
So I figured out why the query tried to select all of the attributes.
ActiveAdmin tries to create a filter area, by default and retrieves all possibilities for the belongs_to association in order to create a drop down.
To get around this I wrote a custom filter which excludes the attribute like:
filter :name

Related Links

Creating a new admin user in activeadmin
ActiveAdmin limiting has_many association retrieval?
In Active Admin, all of my models form views seem to refer just one of those models
Rails ActiveAdmin : How to place filters on the top in index action
change css styles of active admin
Active admin install with Rails 4
ActiveAdmin won't save has many and belongs to many field
Truncate data in ActiveAdmin index page
Active Admin: how to set filter label dynamically
How to add an HTML-class to an ActiveAdmin index table
How to use modules to split very long code in active admin?
Downloading all records of a paginated resource in ActiveAdmin
Can you use the Form() command in ActiveAdmin in the content of a custom page?
CollectionAction route being skipped, action treated as ID
Possible to “split” an ActiveAdmin resource between multiple menu items?
Rails: activeadmin, undefined method `per' for #<ActiveRecord::Relation:0x4d15ee0>

Categories

HOME
python-2.7
xpath
android-espresso
d3.js
windows-10
kivy
adobe
visual-studio-2010
websocket
nsis
material-components
drag-and-drop
native-base
circleci
business-intelligence
freertos
ex
texas-instruments
global-variables
jitsi
gitkraken
coreldraw
chronicle-queue
exchange-server-2010
pdf.js
xdebug
openbravo
oracleforms
mdns
argv
wampsharp
ms-media-foundation
bean-validation
assertions
xvfb
recovery
windows-store
morphline
moinmoin
vesta
react-intl
daz3d
swift2.3
django-static-precompiler
phppgadmin
renderman
sonatype
line-intersection
aurelia-fetch-client
apache-modules
pecl
emf-compare
yargs
msg
logical
dcount
data-management
decoder
unsigned
distributed-cache
textblock
verisign
gulp-uglify
psd
ui4j
json-spirit
place
srv-record
highest
knife
featuretoggle
bootstrap-wysiwyg
mojo
google-hangouts
forceclose
miglayout
wso2bam
jms-serializer
spring-social-linkedin
mft
strcmp
insertonsubmit
sunstudio
donut-chart
android-authenticator
jquery-dialog
idispatch
delphi-prism
filelock
kohana-auth
ios-4.2
chunking
iphone-sdk-4.3
mysqli-multi-query
3270
projectpier
main-method
database-cloning

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App