Project

blue_csv

0.0
No commit activity in last 3 years
No release in over 3 years
Renders CSV files as view templates.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

Runtime

~> 3.2.2
 Project Readme

Write CSV files as if they were normal view templates and they will be downloaded as attachments.

Installation

  • Add the following to your app's Gemfile
gem 'blue-csv'
  • Or as a standalone gem by running on your shell:
gem install blue-csv

Usage

The plugin exposes the object csv in your view templates, so you can write in your index.csv.blue:

csv << ["Title", "Author"]

@books.each do |book|
  csv << [book.title, book.author]
end

Your controller code would look like this:

def index
  @books = Book.all
  respond_to do |format|
    format.html
    format.csv { render :csv => 'export' }
  end
end

Copyright © 2012 Artan Sinani