How to configure disabling load has_many association on show and edit. #1574

Closed
Curter29 opened this Issue Mar 22, 2013 · 8 comments

Projects

None yet

4 participants

@Curter29

I have Client and Message, on client has_many message, and if client has 1 Million message rails_admin, try to load all 1M, how to disable load in this case?

I read Wiki and don't find any solution (

@giangnguyennet

Me too, have you found the solution yet?

@Curter29

No so far (

@omnikron

@sferik @Curter29 is there any known solution to this? I've inherited an app where Users have hundreds of thousands of messages, and they are all displayed on the rails admin page for that user. I can't find any way to limit the number that are displayed. Any help would be most welcome or I'll have to remove rails_admin altogether.

@hajder

Excluding fields from model doesn't work?

@Curter29

Hello @hajder from fresh view, maybe this can help

2014-08-21 20 16 27

@hajder

I don't have this problem, just following RailsAdmin repo and trying to help a little :)

@omnikron

@hajder - ah, it does, thanks! I didn't realise it was possible to hide children (the name field confused me a bit). For anybody else wondering about this, to hide has_many children from view do:

# config/initializers/rails_admin.rb
RailsAdmin.config do |config|
  #...
  config.model Parent do
    exclude_fields :children, :other_children
  end
end

that would work in the case of the following model:

# example model
class Parent < ActiveRecord::Base
  has_many :children
  has_many :other_children
  #...
end
@Curter29

God bless ruby community

@Curter29 Curter29 closed this Aug 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment