speeding up draggable_lists by specifying select columns

19 views
Skip to first unread message

Loren Siebert

unread,
Dec 11, 2012, 6:51:40 PM12/11/12
to actives...@googlegroups.com
I have a model that has many affiliates, and this works to let me drag/drop affiliates that a user has access to:
    config.columns[:affiliates].form_ui = :select
    config.columns[:affiliates].options = { :draggable_lists => true }

When I edit the User and it loads the Affiliates, it does so with this SQL:
  Affiliate Load (0.4ms)  SELECT `affiliates`.* FROM `affiliates` 

This takes a long time in production, so I want to tell active scaffold to just load [:id, :name] for the Affiliate model as that's all it needs for the draggable lists.

It seems like this should be possible and easy, but maybe I'm just missing the syntax. This does not work:
    config.columns[:affiliates].form_ui = :select
    config.columns[:affiliates].options = { :draggable_lists => true }
    config.columns[:affiliates].includes = nil
    config.columns[:affiliates].select_columns = [:id, :name]

Any suggestions?
Reply all
Reply to author
Forward
0 new messages