index.html.erbどのように私は、フォーム
= form_for :file_upload, :html => {:multipart => true} do |f|
= f.label :uploaded_file, 'Upload your file.'
= f.file_field :uploaded_file
= f.submit "Load new dictionary"
モデル
def file_upload
file = Tempfile.new(params[:uploaded_file])
begin
@contents = file
ensure
file.close
file.unlink # deletes the temp file
end
end
インデックス
def index
@contents
end
しかし、何が私の中に印刷されていないばかりされて一時ファイルの内容を取得しますファイルをアップロードした後のページ= @contents
コンテンツをインデックスに戻すにはどうすればよいですか – ahmet