0
這是一個錯誤,但我叫了一些模型Test
(導致它實際上是一個測試)。現在回滾它併爲模型提供另一個名稱已經很晚了,因爲這樣我需要檢查很多關於更改模型名稱的代碼。 問題。當我在控制檯中調用有關Test的任何信息時,它會導致錯誤。Rails:測試模塊和模型衝突
>> User.last
#<User id: 44, email: nil, password_digest: nil, created_at: "2013-05-08 11:26:04", updated_at: "2013-05-08 11:26:04", guest: true>
User Load (4.0ms) SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
>> @test=Test.last
NoMethodError: undefined method `last' for Test:Module
from (irb):7
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands/console.rb:47:in `start'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands/console.rb:8:in `start'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands.rb:41:in `<top (required)>'
from C:/Users/HP/study/script/rails:6:in `require'
from C:/Users/HP/study/script/rails:6:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
我該怎麼辦?
是的遷移,我可以,但是這意味着重構所有的代碼測試所提到的,它不僅是tests_controller,但其他控制器,助手,模型。 – 2013-05-08 16:44:19
你應該現在做,而不是以後,我認爲這是最好的方法。 – 2013-05-08 16:45:30