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.
test.rbという名前のモデルがあり、コントローラーで@ tests = Test.newを使用すると、次のエラーが発生します。誰かがこれをどのように解決できますか?「Test:Moduleの未定義のメソッド「新規」」
名前の競合があるように思われる場合、testはすでにTestというモジュールの名前になっているようです。モジュールに独自のモデルを配置してみてください。
module MyModule class Test < ActiveRecord::Base end end
そしてそれをそのように呼ぶ
@test = MyModule::Test.new