lib/typus/controller/format.rb in typus-3.0.12 vs lib/typus/controller/format.rb in typus-3.1.0.rc1

- old
+ new

@@ -1,21 +1,21 @@ if RUBY_VERSION >= '1.9' require 'csv' - FasterCSV = CSV else require 'fastercsv' + CSV = FasterCSV end module Typus module Controller module Format protected def generate_html items_per_page = @resource.typus_options_for(:per_page) - @items = @resource.paginate(:per_page => items_per_page, :page => params[:page]) + @items = @resource.page(params[:page]).per(items_per_page) end #-- # TODO: Find in batches only works properly if it's used on models, not # controllers, so in this action does nothing. We should find a way @@ -26,10 +26,10 @@ filename = Rails.root.join("tmp", "export-#{@resource.to_resource}-#{Time.zone.now.to_s(:number)}.csv") options = { :conditions => @conditions, :batch_size => 1000 } - ::FasterCSV.open(filename, 'w') do |csv| + ::CSV.open(filename, 'w', :col_sep => ';') do |csv| csv << fields.keys @resource.find_in_batches(options) do |records| records.each do |record| csv << fields.map do |key, value| case value