Save 36% for Black Friday! Learn more

All threads / Rails Admin with has_many association

Ask A Question

Notifications

You’re not receiving notifications from this thread.

Rails Admin with has_many association

Jahnavi asked in Rails

Hi all,

We are using rails_admin for manging our data on admin side.

We are facing an issue with has_many association ,** its executing the query to fetch the details and along with it also executing one more query to get total count from that table.
i.e. see below queries.
SELECT * FROM table_nameWHERE condition
SELECT COUNT() FROM table_nameWHERE condition*

Here;s sample model.

has_many :users, :foreign_key => :user_id, :primary_key => :id

rails_admin do
edit do
field :users do
label "Linked Users"
inline_add false
end
end
end

Can you please help me how can we avoid execution of second query.

Thanks in advance

FYI - I found rails admin to have a large memory leak. Recommend removing it.

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 39,376+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.