javascript_include_tag返回nil而不是google api密钥

时间:2017-12-26 15:01:56

标签: javascript ruby-on-rails heroku ruby-on-rails-5

我正在制作我的应用程序,但我被卡住了...... 我的应用程序正在使用谷歌地图,以便让这些东西工作,添加了某种代码。

使用figaro所以我的ENV看起来像:

GOOGLE_MAPS_API_KEY: 'my api key'

然后在模板中:

<%= javascript_include_tag "https://maps.googleapis.com/maps/api/js?key=#{ENV['GOOGLE_MAPS_API_KEY']}&callback=myMap" %>

在开发环境中,一切正常,但在herokus上没有...... 日志:

&#13;
&#13;
2017-12-26T14:49:36.678130+00:00 app[web.1]: [20faebf2-3d32-4a2a-a257-a3585348f441] Completed 500 Internal Server Error in 21ms
2017-12-26T14:49:36.679197+00:00 app[web.1]: [20faebf2-3d32-4a2a-a257-a3585348f441]   
2017-12-26T14:49:36.679260+00:00 app[web.1]: [20faebf2-3d32-4a2a-a257-a3585348f441] ActionView::Template::Error (nil is not a valid asset source):
2017-12-26T14:49:36.679516+00:00 app[web.1]: [20faebf2-3d32-4a2a-a257-a3585348f441]     65:   </footer>
2017-12-26T14:49:36.679518+00:00 app[web.1]: [20faebf2-3d32-4a2a-a257-a3585348f441]     66: </div>
2017-12-26T14:49:36.679518+00:00 app[web.1]: [20faebf2-3d32-4a2a-a257-a3585348f441]     67: 
2017-12-26T14:49:36.679519+00:00 app[web.1]: [20faebf2-3d32-4a2a-a257-a3585348f441]     68: <%= javascript_include_tag ENV["GoogleMap"] %>
2017-12-26T14:49:36.679520+00:00 app[web.1]: [20faebf2-3d32-4a2a-a257-a3585348f441]     69: <%= javascript_include_tag "animate" %>
2017-12-26T14:49:36.679570+00:00 app[web.1]: [20faebf2-3d32-4a2a-a257-a3585348f441]   
&#13;
&#13;
&#13;

2017-12-26T14:49:36.678130+00:00 app[web.1]: [20faebf2-3d32-4a2a-a257-a3585348f441] Completed 500 Internal Server Error in 21ms 2017-12-26T14:49:36.679197+00:00 app[web.1]: [20faebf2-3d32-4a2a-a257-a3585348f441]
2017-12-26T14:49:36.679260+00:00 app[web.1]: [20faebf2-3d32-4a2a-a257-a3585348f441] ActionView::Template::Error (nil is not a valid asset source): 2017-12-26T14:49:36.679516+00:00 app[web.1]: [20faebf2-3d32-4a2a-a257-a3585348f441] 65: </footer> 2017-12-26T14:49:36.679518+00:00 app[web.1]: [20faebf2-3d32-4a2a-a257-a3585348f441] 66: </div> 2017-12-26T14:49:36.679518+00:00 app[web.1]: [20faebf2-3d32-4a2a-a257-a3585348f441] 67: 2017-12-26T14:49:36.679519+00:00 app[web.1]: [20faebf2-3d32-4a2a-a257-a3585348f441] 68: <%= javascript_include_tag ENV["GoogleMap"] %> 2017-12-26T14:49:36.679520+00:00 app[web.1]: [20faebf2-3d32-4a2a-a257-a3585348f441] 69: <%= javascript_include_tag "animate" %> 2017-12-26T14:49:36.679570+00:00 app[web.1]: [20faebf2-3d32-4a2a-a257-a3585348f441]

感谢您的反馈

1 个答案:

答案 0 :(得分:1)

此命令允许将配置复制到heroku:

figaro heroku:set -e production