def move_file
to_path[“queue/”]="" “#{from_path}”, “#{to_path}”
redirect_to request.referrer

request parameters:


i get this error:


in RecordingsController#move_file

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

around ... "#{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?

  def move_file

Have you put a debug print in to check what from_path and to_path are set to?


params[:file_name], from_path, and to_path all point to the same
object. to verify, check their #object_id.

so if you modify to_path, you also modify the other two. try #dup to
copy an object.

kind regards

the = assignment operator assigns the values from the right side operand to the left side, it doesn’t change the value of other variables, i dunno what you mean and i dunno what #dup is ~ fugee

No because this action doesn’t print, it moves the file and redirects

how can changing to_path affect the value of from_path ?

Because, as botp pointed out, they are referencing (pointing to) the
same object in memory.
to_path = some function of params[....]
to avoid the problem. In a previous post you said you did not know
what dup does. Perhaps you should find out.


Like what inconsequential function of params[:file_name] could i use? i tried params[:file_name].to_s but it had no affect

got it working using dup ~ thanks, fugee

got it working using dup ~ thanks, fugee

Hi can some one show me the code example of using dup