2
我正在將數據從電子表格導入到應用程序數據庫。Rails 4強參數錯誤:沒有將符號隱式轉換爲字符串
數據按行分析。每個解析行的樣子:
{:department=>{
:school=>"Graduate School of Business",
:name=>"Graduate School of Business",
:program=>"MBA Program",
:url=>"http://www.gsb.stanford.edu/mba",
:intro=>"The Stanford MBA Program is a two-year, full-time, residential program.",
:students_number=>"Approximately 80 annually",
:students_with_aids_number=>nil,
:gre_scroe=>nil,
:toefl_score=>nil,
:world_rank=>nil,
:us_rank=>nil,
:without_aid_deadline=>nil,
:with_aid_deadline=>nil,
:salary=>nil,
:institute_id=>1}
}
創建部門:
# att is the hash shown above
department = Department.new(department_params(att))
if !department.save
puts "Error: \n department can't be save: #{department.errors.full_messages}"
end
def department_params params
params.require(:department).permit(:name,:url,:institute_id)
end
但我得到的錯誤:
no implicit conversion of Symbol into String
指向
params.require(:department).permit(:name,:url,:institute_id)
怎麼可能我修復它?謝謝!
保育鈞:你還在嗎? ;) – Mailo 2014-01-07 14:48:09