as_csv:对Rails的即时CSV支持

时间:2021-05-04 12:47:08
【文件属性】:
文件名称:as_csv:对Rails的即时CSV支持
文件大小:42KB
文件格式:ZIP
更新时间:2021-05-04 12:47:08
Ruby CSV 与显示JSON或XML一样,此gem可让您在应用程序中显示CSV。 并非严格要求Rails,但目前魔术仅适用于Rails> 3.xx Ruby 1.8可以使用,但是默认情况下,不能保证列的顺序。 安装 将此行添加到您的应用程序的Gemfile中: gem 'as_csv' , '~> 2.0' 基本用法 只需在控制器中添加respond_to :csv class WidgetsController < ApplicationController respond_to :xml , :json , :csv def index respond_with Widget . all end def show respond_with Widget . find ( params [ :id ] ) end end 或者: class W
【文件预览】:
as_csv-master
----as_csv.gemspec(974B)
----.gitignore(243B)
----.rspec(8B)
----.travis.yml(83B)
----CHANGELOG.md(775B)
----LICENSE.txt(1KB)
----spec()
--------dummy()
--------support()
--------core_ext()
--------models()
--------spec_helper.rb(282B)
--------rails_helper.rb(798B)
--------lib()
--------controllers()
----README.md(4KB)
----script()
--------rspec(372B)
----lib()
--------as_csv.rb(82B)
--------as_csv()
----Gemfile(152B)
----Rakefile(28B)

网友评论