Re: [Rails] FileUtils.mv

2016-04-18 Thread fugee ohu
On Monday, April 18, 2016 at 3:53:44 PM UTC-4, Colin Law wrote: > > On 18 April 2016 at 19:07, fugee ohu > wrote: > > ... > > how can changing to_path affect the value of from_path ? > > Because, as botp pointed out, they are referencing (pointing to) the > same object

Re: [Rails] FileUtils.mv

2016-04-18 Thread fugee ohu
On Monday, April 18, 2016 at 12:13:37 PM UTC-4, bot Peña wrote: > > On Mon, Apr 18, 2016 at 10:50 PM, fugee ohu > wrote: > > def move_file > > from_path=params[:file_name] > > to_path=params[:file_name] > > to_path["queue/"]="" > > FileUtils.mv

Re: [Rails] FileUtils.mv

2016-04-18 Thread fugee ohu
On Monday, April 18, 2016 at 3:53:44 PM UTC-4, Colin Law wrote: > > On 18 April 2016 at 19:07, fugee ohu > wrote: > > ... > > how can changing to_path affect the value of from_path ? > > Because, as botp pointed out, they are referencing (pointing to) the > same object

Re: [Rails] FileUtils.mv

2016-04-18 Thread Colin Law
On 18 April 2016 at 19:07, fugee ohu wrote: > ... > 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. Use to_path = some function of params[] to avoid the problem. In a

Re: [Rails] FileUtils.mv

2016-04-18 Thread fugee ohu
On Monday, April 18, 2016 at 11:32:07 AM UTC-4, Colin Law wrote: > > On 18 April 2016 at 15:50, fugee ohu > wrote: > > def move_file > > from_path=params[:file_name] > > to_path=params[:file_name] > > to_path["queue/"]="" > > Have you put a debug print in

Re: [Rails] FileUtils.mv

2016-04-18 Thread fugee ohu
On Monday, April 18, 2016 at 11:32:07 AM UTC-4, Colin Law wrote: > > On 18 April 2016 at 15:50, fugee ohu > wrote: > > def move_file > > from_path=params[:file_name] > > to_path=params[:file_name] > > to_path["queue/"]="" > > Have you put a debug print in

Re: [Rails] FileUtils.mv

2016-04-18 Thread fugee ohu
On Monday, April 18, 2016 at 12:13:37 PM UTC-4, bot Peña wrote: > > On Mon, Apr 18, 2016 at 10:50 PM, fugee ohu > wrote: > > def move_file > > from_path=params[:file_name] > > to_path=params[:file_name] > > to_path["queue/"]="" > > FileUtils.mv

Re: [Rails] FileUtils.mv

2016-04-18 Thread botp
On Mon, Apr 18, 2016 at 10:50 PM, fugee ohu wrote: > 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 > params[:file_name],

Re: [Rails] FileUtils.mv

2016-04-18 Thread Colin Law
On 18 April 2016 at 15:50, fugee ohu 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

[Rails] FileUtils.mv

2016-04-18 Thread fugee ohu
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",