A scope(ActiveRecord::Relation) and a array of active_record are able to be spreadsheet with this module.
Installation
Add this line to your application's Gemfile:
gem 'spreadsheetable'
And then execute:
$ bundle
Usage
scope = AModel.all #scope or array
scope.extend Spreadsheetable
scope.sheet_columns = %w(id name other)
xls_file = scope.xls # or scope.to_spreadsheet
Contributing
- Fork it ( http://github.com/dongoon/spreadsheetable/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request