將CSV導出使用逗號的現有應用升級到了Ruby 1.9.2,現在無需導出。基本上,服務器只是坐着和旋轉。我知道對逗號有FasterCSV依賴關係,但1.9.2中不再支持FasterCSV,因爲CSV是核心。在Ruby 1.9.2中導出爲CSV
根據文檔,逗號應該工作,即使沒有FasterCSV,但我沒有那種經驗。我不能得到任何使用此代碼導出:
控制器:
format.csv do
@sis_action_rendered = true
render :csv => current_user.authorized_clinical_stuff
end
MODEL:
comma do # implicitly named :default
user :salutation
name
email
user :login
user :ethnicity
user :gender
user :is_verified => 'APTA Trained'
work_phone
alternate_phone
site_names
site_address
degree
pt_degree
ci_credentialed?
ci_advanced_credentialed?
board_certs
updated_at
end
記住型號代碼是拉動信息來回幾個相關對象來產生一個CSV。
當您嘗試在控制檯中生成CSV時會發生什麼? – 2011-04-11 20:08:48
使用上面的信息生成CSV會很困難。我可以在一些例子中生成CSV,但這只是一個小的散列的CSV。這更復雜。 – Aspleenic 2011-04-12 14:26:40