滑轨型号

编程入门 行业动态 更新时间:2024-10-28 17:13:24
本文介绍了滑轨型号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个名为test.rb的模型,当我在控制器中使用@ tests = Test.new时,出现以下错误.有人可以我怎么解决这个问题吗? "Test:Module的未定义方法'new'"

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 resolve this? "undefined method `new' for Test:Module"

推荐答案

如果似乎您的命名冲突,则好像test已经是一个名为Test的模块的名称.尝试将自己的模型放在模块中,即

Looks like test is already the name of a module called Test if would seem that you have naming conflict. Try placing your own model in a module ie

module MyModule class Test < ActiveRecord::Base end end

然后这样称呼

@test = MyModule::Test.new

更多推荐

滑轨型号

本文发布于:2023-08-07 14:58:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1319742.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:滑轨   型号

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!