Forum: Rails-ES Excel

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
De20b7427a7300175a8149a48a29c3da?d=identicon&s=25 Lourdes (Guest)
on 2006-12-22 12:33
Hola, estoy utilizando este código que he cogido de este foro.

def excel
    CSV::Writer.generate(output = "") do |csv|
      Ordenador.find(:all).each do |o|
        csv << [o.id, o.name]
      end
    end
    send_data(output,
            :type => "application/vnd.ms-excel",
            :filename => "orders.csv")
  end

y me da el siguiente error.

uninitialized constant ExcelController::CSV


¿podeis decidme a que se debe?

Muchas gracias
7223c62b7310e164eb79c740188abbda?d=identicon&s=25 Xavier Noria (Guest)
on 2006-12-22 12:41
(Received via mailing list)
On Dec 22, 2006, at 12:33 PM, Lourdes wrote:

>             :filename => "orders.csv")
>   end
>
> y me da el siguiente error.
>
> uninitialized constant ExcelController::CSV

Tiene pinta de que no cargaste la libreria csv

   require 'csv'

-- fxn
De20b7427a7300175a8149a48a29c3da?d=identicon&s=25 Lourdes (Guest)
on 2006-12-22 13:03
Muchas gracias. Si que era eso
This topic is locked and can not be replied to.