【发布时间】:2013-04-10 19:02:16
【问题描述】:
我是 Rails 开发的新手,有点乱! 我已经获得了一个代码库,并且 HTML 中没有引用任何资产。没有失败的网络请求,它们根本没有包含在标记中!当我尝试使用他们的 URL 直接访问它们时,它们就在那里。
作为比较 - 我的同事系统最终会收到大约 30 个左右的请求,并且最终结果是完全样式化的。但是我没有样式,只有基本标记。
我已经阅读了大量内容并检查了我的配置,检查了我是否在开发模式下运行等等。我真的被难住了!
不管怎样,我目前在一个跨平台的团队环境中工作,那里有使用 Linux、Windows 和 Mac OS X 的开发人员。没有人有这些问题;而且我很确定其他使用 Mac OS X 的开发人员的设置与我的完全一样!
源代码是从与其他人相同的 git 存储库中获取的,并且绝对是最新的。以下是 rails 的输出:注意没有错误。
=> Booting WEBrick
=> Rails 3.2.6 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
SECURITY WARNING: No secret option provided to Rack::Session::Cookie.
This poses a security threat. It is strongly recommended that you
provide a secret to prevent exploits that may be possible from crafted
cookies. This will not be supported in future versions of Rack, and
future versions will even invalidate your existing user cookies.
Called from: /******************/abstract_store.rb:28:in `initialize'.
[2013-04-17 21:20:55] INFO WEBrick 1.3.1
[2013-04-17 21:20:55] INFO ruby 2.0.0 (2013-02-24) [x86_64-darwin12.3.0]
[2013-04-17 21:20:55] INFO WEBrick::HTTPServer#start: pid=22421 port=3000
Started GET "/" for 127.0.0.1 at 2013-04-17 21:21:05 +0100
Processing by AccountsController#home as HTML
Completed 401 Unauthorized in 6ms
Started GET "/users/sign_in" for 127.0.0.1 at 2013-04-17 21:21:05 +0100
Processing by Devise::SessionsController#new as HTML
Rendered devise/shared/_links.erb (1.5ms)
Rendered devise/sessions/new.html.erb within layouts/application (10.0ms)
Rendered layouts/_navigation.html.erb (1.0ms)
Rendered layouts/_messages.html.erb (0.3ms)
Completed 200 OK in 776ms (Views: 86.5ms | ActiveRecord: 647.5ms)
Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-04-17 21:21:06 +0100
Served asset /application.js - 304 Not Modified (1ms)
Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-04-17 21:21:06 +0100
Served asset /application.css - 304 Not Modified (1ms)
注意:application.js 似乎只有 5 个 //=require 指令;并且 application.css 主要包含带有一些简单规则的 cmets - 远不及应该存在的内容。
【问题讨论】:
-
我也发生了同样的事情,我将我的 rails 版本更新到了最新版本,运行
bundle update并重新安装了 rvm。我不确定这三件事中的哪一个修复了它,但在完成所有这些之后,资产都被包括在内了。 -
我刚刚看到这个很有趣 - 我想这可能是你的问题。不幸的是,我找不到在 Mac OS X 上更新 rails 的方法,因为一切都表明我是迄今为止的 - 尽管我的版本存在安全问题..?!
-
你是如何安装 Rails 的?你在使用 RVM 吗?
-
只有 gem,我确实有 RVM - 我想我可以尝试使用它来升级它
标签: ruby-on-rails ruby configuration