index.html.erbWie bekomme ich den Inhalt der temporären Datei über ein Formular
= 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"
Modell
def file_upload
file = Tempfile.new(params[:uploaded_file])
begin
@contents = file
ensure
file.close
file.unlink # deletes the temp file
end
end
Index
def index
@contents
end
Aber nichts gedruckt wird immer in meinem Seite nach dem Hochladen einer Datei = @contents
Wie kann ich den Inhalt zurück zum Index senden – ahmet