Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
anoiaque
committed
May 1, 2010
1 parent
03c87a7
commit 332e3d4
Showing
1 changed file
with
23 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,28 @@ | ||
= Introduction | ||
I first used the good "arydjmal/to_xls" plugin but it doesn't allow collections of multiples objects from different class and can't export | ||
I first used the good "arydjmal/to_xls" plugin but it doesn't allow collections of multiples objects from different classes and can't export | ||
associations attributes of a class. | ||
|
||
With to_excel gem you can export multiples collections of objects of different class, moreover you have the possibility of | ||
With to_excel gem you can export multiples collections of objects of different classes, moreover you have the possibility of | ||
exporting associations's attributes (recursively). | ||
|
||
= Usage | ||
|
||
== Basic usage | ||
@users = User.all | ||
|
||
With one collection, all columns are exported with default humanized attributes names for excel columns : | ||
|
||
[@users].to_excel | ||
|
||
If you don't want excel header : | ||
|
||
@users.to_excel headers => false | ||
|
||
To restrict attributes : | ||
|
||
[@users].to_excel(:map => {User => [:age, :id, :name]}) #User is the class of users objects. | ||
|
||
|
||
== Multiples collections of different classes | ||
|
||
|