Suggested workaround for Rails mongoid gem users?

78 views
Skip to first unread message

Russell Whitaker

unread,
Jun 10, 2013, 1:51:50 PM6/10/13
to ax...@googlegroups.com, digial....@gmail.com
My stack:

rails (3.2.13)
axlsx (1.3.6)
axlsx_rails (0.1.4)
mongoid (3.1.4)

'axlsx_rails' is declared in the Gemfile.

What I want to do:

  def export
    @report = @website.reports.find(params[:report_id]) 
    
    respond_to do |format|
      format.xlsx { render xlsx: @report }
    end
  end

A failing test which tries to do this thing:

1) ReportsController GET #export.xlsx
     Failure/Error: get :export, website_id: website._id, report_id: report._id, format: :xlsx
     NoMethodError:
       undefined method `sub!' for #<Report:0x007f857e1f95b8>
     # ./app/controllers/reports_controller.rb:50:in `block (2 levels) in export'
     # ./app/controllers/reports_controller.rb:49:in `export'
     # ./spec/controllers/reports_controller_spec.rb:97:in `block (3 levels) in <top (required)>'

I am not using ActiveRecord on my models, I'm using Mongoid (mongodb sits underneath it all.)
I am aware from some hours spent RTFM'ing the docs and this mailing list and StackOverflow and a close
reading of the source that these libs assume ActiveRecord. What I'm wondering is if anyone else 
has tried axlsx and axlsx_rails and/or acts_as_xlsx in a Mongoid context and gotten any of it
to work for them. I'm figuring some have tried, but silently given up. 

Anyone?

I have tried, unsuccessfully the last few days at different times - assuming Randy Morgan is back 
in Japan - to raise someone on irc as per the github repo README, but there seems to be no such 
channel recently on irc.freenode.net.

Any insight/help at all would be *greatly* appreciated.

Thanks, Russell

maciej.e...@captatio.pl

unread,
Oct 7, 2014, 3:47:27 PM10/7/14
to ax...@googlegroups.com, digial....@gmail.com, russell....@gmail.com
Did you managed to solve this problem whith using axlsx with mongoid?
Reply all
Reply to author
Forward
0 new messages