Search code examples
ruby-on-railsruby-on-rails-3excelrake-task

Rails to_xls in rake task


I am trying to use the rails to_xls gem in my rake task. My code is:

tmp_file = Tempfile.new(['export_test', '.xls'])
ToXls::ArrayWriter.new(@logins_report, :name => 'export_test').write_io(tmp_file)

I receive an error that says "rake aborted! uninitialized constant ToXls" Any suggestions?


Solution

  • Turns out my gem file would not update to the new version. I had to add the "~> 1.0.0" after it and run bundle install.