rails 控制台错误需要 './example_user' [英] rails console error require './example_user'
本文介绍了rails 控制台错误需要 './example_user'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 http://ruby.railstutorial 使用 railstutorial.org/chapters/rails-flavored-ruby#sec:a_user_class
我被告知输入 require './example_user'
但是...我收到此错误
I've been told to type require './example_user'
but... I get this error
LoadError: cannot load such file -- example_user
from /Users/snook3/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in require'
然后越来越多的错误
我想我没有正确链接到那个文件夹,谁能告诉我我也应该链接到哪里?
I imagine that I'm not linking correctly to that folder, can anyone let me know where I should be linking too?
推荐答案
是的,只需将文件移动到实际的根目录即可.做 mv example_user.rb*/
应该这样做.
Yes, just move the file to the actual root directoy. Doing mv example_user.rb* /
should do it.
另外,如果在请求文件后返回true"而不是 ["User"],请不要担心.
Also, don't worry if after requiring the file, you get a return of "true" instead of ["User"].
这篇关于rails 控制台错误需要 './example_user'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文