Ruby on Rails Monday, April 18, 2016

  def move_file
    from_path=params[:file_name]
    to_path=params[:file_name]
    to_path["queue/"]=""
    FileUtils.mv "#{from_path}", "#{to_path}"
    redirect_to request.referrer
  end

request parameters:
{"file_name"=>"recordings/WCR-20160409.mp3",   "file_type"=>"to_be_moved",   "page"=>"list_directory"}

i get this error:

Errno::ENOENT in RecordingsController#move_file

No such file or directory @ sys_fail2 - (recordings/WCR-20160409.mp3, recordings/WCR-20160409.mp3)

around ... FileUtils.mv "#{from_path}", "#{to_path}"

I'm trying to move the file from the recordings/queue/ direcotry up a level to recordings/ I don't really understand the error it looks like it's taking both arguments, from_path and to_path and treating them as a combined first argument Anyone?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/efc084af-3b60-4ebe-9b0d-cdad52b595b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment