Frage

I have the following call using comma gem:

def by_location_csv
  @inventory_items=InventoryItem.where('location_id=? and is_deleted=false',params[:location_id]).order(:bin_number)
  render :csv => @inventory_items
end

but the order is ignored with this in the log:

Scoped order and limit are ignored, it's forced to be batch order and batch size

Is there any workaroud to this? can I pass in an option to up the batch size or just turn it off?

War es hilfreich?

Lösung

in your example, comma is being used during the rendering, not the ordering.

examine the sql generated by each of your chained scope methods to resolve the ordering.

see also Limit not working as expected in Rails3

Andere Tipps

A bit late, but for anyone else with the same issue then I've found all you need to do is append '.all' to the variable/query, e.g.

render :csv => @inventory_items.all

OP was tagged as 3.2, but I can only validate this as working in 4.0

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top