by on Rails can't convert ActiveSupport::HashWithIndifferentAccess into String

09.10 Muhamad Akbar Bin Widayat 0 Comments

Ruby on Rails logo
Ruby on Rails logo (Photo credit: Wikipedia)
Hi Everyone,

I had a errors can't convert ActiveSupport::HashWithIndifferentAccess into String. This errors because I wrong on determining params json.

For example:
1. I had params:
{:tabular => {"file"=>"data_tabular_Pemerintahan (Adm Pemerintahan, Aparatur Negara dan Adm Kepegawaian)_kecamatan Admin_2013.xls"}}
2. I call on my speadsheet:
    def export
      workbook = Spreadsheet.open(params[:tabular])
    end
3. On above is not specified to parse parameter. So put this
    def export
      workbook = Spreadsheet.open(params[:tabular][:file])
    end

I hope this article can help you,
Enhanced by Zemanta

0 komentar:

terimakasih komentarnya