Rail models
I have a model named test.rb and when I use @tests = Test.new in my controller I get the following error. Can someone temme how can I solve this? "undefined method` new 'for Test: Module "
+2
Nave
source
to share
1 answer
It looks like the test is already the name of a module called Test if it looks like you have a name conflict. Try to place your own model in a module i.e.
module MyModule
class Test < ActiveRecord::Base
end
end
and then calling it like that
@test = MyModule::Test.new
+3
MonsterMagnet
source
to share