Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 用于生成下载文件的控制器正在开发中,但在Heroku上失败_Ruby On Rails_Heroku - Fatal编程技术网

Ruby on rails 用于生成下载文件的控制器正在开发中,但在Heroku上失败

Ruby on rails 用于生成下载文件的控制器正在开发中,但在Heroku上失败,ruby-on-rails,heroku,Ruby On Rails,Heroku,我有一个在我的开发环境中工作的控制器。它是由用户单击链接并生成.rdp进行下载而触发的。在我的开发环境中工作,但是,当尝试在Heroku上使用它时,我被重定向到根页面 我刚刚对heroku进行了git推送,它告诉我一切都是最新的 我的控制器 希罗库尾木 您无需将其写入文件即可发送,只需立即将其与send_数据一起发送即可: 你确认你运行的是相同版本的Ruby吗?你对生产环境有什么不同于开发的限制吗?从我目前的阅读来看。。。看起来我需要沿着{RAILS\u ROOT}/tmp/的行指定一些内容,这

我有一个在我的开发环境中工作的控制器。它是由用户单击链接并生成.rdp进行下载而触发的。在我的开发环境中工作,但是,当尝试在Heroku上使用它时,我被重定向到根页面

我刚刚对heroku进行了git推送,它告诉我一切都是最新的

我的控制器

希罗库尾木


您无需将其写入文件即可发送,只需立即将其与send_数据一起发送即可:


你确认你运行的是相同版本的Ruby吗?你对生产环境有什么不同于开发的限制吗?从我目前的阅读来看。。。看起来我需要沿着{RAILS\u ROOT}/tmp/的行指定一些内容,这样我就可以写入Heroku/tmp/目录。但是我需要找出正确的语法,这个解决方案仍然不起作用。还在做heroku的重定向。不过它在开发环境中也可以工作。显示控制器的完整源代码之后,您可能有一个筛选器阻止它运行。这是整个控制器-筛选器之前的两个筛选器之一:authenticate\u user!,加载和授权资源导致发生此重定向。你可能没有登录到Heroku版本。我99.9%确定我没有做错。我刚刚在heroku上加载了你的版本。我已经注销,重新登录,刷新,甚至尝试在另一个浏览器。。。它仍在重定向。
def createrdpfile
jumpsquare = Jumpsquare.find(params[:id])
file = Tempfile.new(jumpsquare.ipordns.to_s + '.rdp')
file.write("screen mode id:i:2
  desktopwidth:i:1436
  desktopheight:i:925
  session bpp:i:16
  auto connect:i:1
  full address:s:" + jumpsquare.ipordns.to_s + "
  compression:i:1
  keyboardhook:i:2
  audiomode:i:2
  redirectdrives:i:0
  redirectprinters:i:0
  redirectcomports:i:0
  redirectsmartcards:i:0
  displayconnectionbar:i:1
  alternate shell:s:
  shell working directory:s:
  disable wallpaper:i:1
  disable full window drag:i:1
  disable menu anims:i:1
  disable themes:i:1
  bitmapcachepersistenable:i:1
  winposstr:s:0,3,0,0,800,600
  redirectclipboard:i:1
  redirectposdevices:i:0
  drivestoredirect:s:
  autoreconnection enabled:i:1
  authentication level:i:0
  prompt for credentials:i:0
  negotiate security layer:i:1
  remoteapplicationmode:i:0
  allow desktop composition:i:0
  allow font smoothing:i:0
  disable cursor setting:i:0
  gatewayhostname:s:
  gatewayusagemethod:i:0
  gatewaycredentialssource:i:4
  gatewayprofileusagemethod:i:0"
)
file.close
send_file(file.path, :filename => jumpsquare.ipordns.to_s + '.rdp', :type=>'application/rdp')
#send_file file.path, :type=>'application/rdp'
end
2013-12-08T03:54:50.830006+00:00 app[web.1]: Started GET "/jumpsquares/286/createrdpfile" for 99.53.77.161 at 2013-12-08 03:54:50 +0000
2013-12-08T03:54:50.830729+00:00 app[web.1]: Started GET "/jumpsquares/286/createrdpfile" for 99.53.77.161 at 2013-12-08 03:54:50 +0000
2013-12-08T03:54:50.835417+00:00 app[web.1]: Processing by JumpsquaresController#createrdpfile as HTML
2013-12-08T03:54:50.835417+00:00 app[web.1]: Processing by JumpsquaresController#createrdpfile as HTML
2013-12-08T03:54:50.835657+00:00 app[web.1]:   Parameters: {"id"=>"286"}
2013-12-08T03:54:50.835657+00:00 app[web.1]:   Parameters: {"id"=>"286"}
2013-12-08T03:54:50.878697+00:00 app[web.1]: Redirected to http://www.jumpsquares.net/jumpsquares
2013-12-08T03:54:50.878697+00:00 app[web.1]: Redirected to http://www.jumpsquares.net/jumpsquares
2013-12-08T03:54:50.879290+00:00 app[web.1]: Completed 302 Found in 43ms (ActiveRecord: 7.6ms)
2013-12-08T03:54:50.879290+00:00 app[web.1]: Completed 302 Found in 43ms (ActiveRecord: 7.6ms)
2013-12-08T03:54:50.888283+00:00 heroku[router]: at=info method=GET path=/jumpsquares/286/createrdpfile host=www.jumpsquares.net fwd="99.53.77.161" dyno=web.1 connect=2ms service=60ms status=302 bytes=104
2013-12-08T03:54:51.072305+00:00 app[web.1]: Started GET "/jumpsquares" for 99.53.77.161 at 2013-12-08 03:54:51 +0000
2013-12-08T03:54:51.073470+00:00 app[web.1]: Started GET "/jumpsquares" for 99.53.77.161 at 2013-12-08 03:54:51 +0000
2013-12-08T03:54:51.075021+00:00 app[web.1]: Processing by JumpsquaresController#index as HTML
2013-12-08T03:54:51.076274+00:00 app[web.1]: Processing by JumpsquaresController#index as HTML
2013-12-08T03:54:51.304897+00:00 app[web.1]:   Rendered jumpsquares/index.html.erb within layouts/application (186.4ms)
2013-12-08T03:54:51.305084+00:00 app[web.1]:   Rendered jumpsquares/index.html.erb within layouts/application (186.4ms)
2013-12-08T03:54:51.319162+00:00 app[web.1]:   Rendered layouts/_header.html.erb (12.8ms)
2013-12-08T03:54:51.319270+00:00 app[web.1]:   Rendered layouts/_header.html.erb (12.8ms)
2013-12-08T03:54:51.321032+00:00 app[web.1]:   Rendered layouts/_footer.html.erb (0.2ms)
2013-12-08T03:54:51.321106+00:00 app[web.1]:   Rendered layouts/_footer.html.erb (0.2ms)
2013-12-08T03:54:51.321501+00:00 app[web.1]: Completed 200 OK in 245ms (Views: 144.5ms | ActiveRecord: 71.3ms)
2013-12-08T03:54:51.321899+00:00 app[web.1]: Completed 200 OK in 245ms (Views: 144.5ms | ActiveRecord: 71.3ms)
2013-12-08T03:54:51.331901+00:00 heroku[router]: at=info method=GET path=/jumpsquares host=www.jumpsquares.net fwd="99.53.77.161" dyno=web.1 connect=2ms service=378ms status=200 bytes=27976
def createrdpfile
  jumpsquare = Jumpsquare.find(params[:id])
  data = "screen mode id:i:2
    desktopwidth:i:1436
    desktopheight:i:925
    session bpp:i:16
    auto connect:i:1
    full address:s:" + jumpsquare.ipordns.to_s + "
    compression:i:1
    keyboardhook:i:2
    audiomode:i:2
    redirectdrives:i:0
    redirectprinters:i:0
    redirectcomports:i:0
    redirectsmartcards:i:0
    displayconnectionbar:i:1
    alternate shell:s:
    shell working directory:s:
    disable wallpaper:i:1
    disable full window drag:i:1
    disable menu anims:i:1
    disable themes:i:1
    bitmapcachepersistenable:i:1
    winposstr:s:0,3,0,0,800,600
    redirectclipboard:i:1
    redirectposdevices:i:0
    drivestoredirect:s:
    autoreconnection enabled:i:1
    authentication level:i:0
    prompt for credentials:i:0
    negotiate security layer:i:1
    remoteapplicationmode:i:0
    allow desktop composition:i:0
    allow font smoothing:i:0
    disable cursor setting:i:0
    gatewayhostname:s:
    gatewayusagemethod:i:0
    gatewaycredentialssource:i:4
    gatewayprofileusagemethod:i:0"

  send_data(data, :filename => jumpsquare.ipordns.to_s + '.rdp', :type=>'application/rdp')
end