如何在Rails 2.3.8中使用Active Scaffold制作CSV格式的用户信息报告
我是新的 Ruby on Rails。我想导出具有用户控制器的用户信息的 CSV 文件。
红宝石版本:1.8.7 Rails 版本:2.3.8
示例:
我有用户控制器:
class Admin::UserController < ApplicationController
active_scaffold :users do |config|
config.list.sorting = {:name => :asc}
config.columns[:name].form_ui=:text_input
config.columns[:name].inplace_edit=true
config.columns[:email].form_ui=:text_input
config.columns[:email].inplace_edit=true
config.columns[:phone].form_ui=:text_input
config.columns[:phone].inplace_edi=true
end
end
型号:用户
class User < ActiveRecord::Base
end
我想将文件导出为 CSV,其中包含我的用户控制器的上述详细信息。这样做有什么要求吗?请任何人都可以指导我。
I am New Ruby on Rails. I want to export CSV File for User Information which is having user controller.
Ruby version: 1.8.7
Rails version: 2.3.8
Example:
I have user controller:
class Admin::UserController < ApplicationController
active_scaffold :users do |config|
config.list.sorting = {:name => :asc}
config.columns[:name].form_ui=:text_input
config.columns[:name].inplace_edit=true
config.columns[:email].form_ui=:text_input
config.columns[:email].inplace_edit=true
config.columns[:phone].form_ui=:text_input
config.columns[:phone].inplace_edi=true
end
end
Model: user
class User < ActiveRecord::Base
end
I want to export file as CSV the above details which having my user controller. is this any requirement for doing this? please anybody can guide me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在寻找 ActiveScaffold Export 插件:
http://code.google.com/p /activescaffoldexport/wiki/Features
https://github.com/ewildgoose/active_scaffold_export
You're looking for the ActiveScaffold Export plugin:
http://code.google.com/p/activescaffoldexport/wiki/Features
https://github.com/ewildgoose/active_scaffold_export