Where to put to_xls and from_xls in a rails app

Posted by Joe Arasin on Stack Overflow See other posts from Stack Overflow or by Joe Arasin
Published on 2009-10-07T23:51:44Z Indexed on 2010/03/27 0:03 UTC
Read the original article Hit count: 267

So I have a model that I need to be able to serialize to/read from an Excel(XLS) document. I am a bit of a loss as to where this code actually belongs. My initial thought is that the to_xls is a view, but after poking around and seeing things like (to|from)_xml and (to|from)_json in ActiveRecord, I was wondering if maybe this stuff belonged in the model. Alternatively, does it belong in just a whole separate container somewhere?

For what it's worth, users will be downloading models from the site, modifying them in excel, then posting them.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about export-to-excel