我有一个Java实例,它似乎使用了一个完全不正确的时区.它使用的是美国/加拉加斯时区,而不是使用Windows正在使用的澳大利亚/悉尼时区.
我检查了Windows时通过系统时钟先,然后检查HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/和ControlSet001,ControlSet002.所有都设置为悉尼时区.
有人知道这是Java中的错误,还是指其他地方设置的时间?
Java版本是1.6.0_06
根据导轨使用情况:
$ rails new --help
Usage:
rails new APP_PATH [options]
Options:
-b, [--builder=BUILDER] # Path to a application builder (can be a filesystem path or URL)
[--old-style-hash] # Force using old style hash (:foo => 'bar') on Ruby >= 1.9
[--skip-gemfile] # Don't create a Gemfile
Run Code Online (Sandbox Code Playgroud)
这个"应用程序构建器"引用了什么,它与应用程序模板(-m选项)的比较如何?
在我的一个观点中,我遇到以下代码的问题:
<% @blog.comments.each do |comment| %>
<h3><%= comment.user.email %></h3>
</div>
<% end %>
Run Code Online (Sandbox Code Playgroud)
哪个产生错误:
NoMethodError in Blogs#show
...
undefined method `email' for nil:NilClass
Run Code Online (Sandbox Code Playgroud)
但是以下代码可以正常运行:
<% @blog.comments.each do |comment| %>
<%= comment.body %>
<% end %>
Run Code Online (Sandbox Code Playgroud)
评论声明为:
class Comment < ActiveRecord::Base
belongs_to :blog
belongs_to :user
end
Run Code Online (Sandbox Code Playgroud)
并且可以在另一个视图中访问email属性:
<% @users.each do |user| %>
<tr>
<td><%= link_to user.username, user %></td>
<td><%= user.email %></td>
</tr>
<% end %>
Run Code Online (Sandbox Code Playgroud)
对我来说,它看起来像comment.user没有被承认为用户模型的实例.我究竟做错了什么?