Ruby on Rails Monday, April 18, 2016



On Monday, April 18, 2016 at 11:32:07 AM UTC-4, Colin Law wrote:
On 18 April 2016 at 15:50, fugee ohu <fuge...@gmail.com> wrote:
>   def move_file
>     from_path=params[:file_name]
>     to_path=params[:file_name]
>     to_path["queue/"]=""

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

Colin

>     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-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@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.

how can changing to_path affect the value of from_path ?

--
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/6ddf3b63-4c6c-4387-be31-c8e6340a2502%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment