2.0.0-p247 :006 > load './app/models/user.rb'
NameError: uninitialized constant ActiveRecord
from /home/action/iAuth/app/models/user.rb:1:in `<top (required)>'
from (irb):6:in `load'
from (irb):6
from /home/action/.rvm/rubies/ruby-2.0.0-p247/bin/irb:13:in `<main>'
以下是我的User Model
。未初始化的常量ActiveRecord
class User < ActiveRecord::Base
end
当我尝试加载我的user.rb in my irb
时,出现上述错误。
你没有在IRB中使用ActiveRecord :: Base类。 –
@Monk_Code:我不明白,我是否应该在IRB – Shane
中加载这个类,你不能在IRB控制台中使用你的模型,而是使用'rails console'来代替,请看下面的答案。 –