Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我使用 rails form_for
form_for @users do |f| end
为什么说 nil 的值为 4?
这可能会帮助你。这是因为 nil 的对象 id 是 4。
http://blog.bigbinary.com/2008/06/23/why-the-id-of-nil-is-4-in-ruby.html
在控制台检查这个,
nil.object_id # => 4
所以这里看起来@users对象为零。