Rails 脑袋抽风给 model 的字段名用了 class

imconfused · March 08, 2015 · Last by shaunli replied at March 09, 2015 · 2095 hits

新建了个 Origin 的 model,20 几个字段,不小心脑袋抽风给起了个 class 的字段名,然后结果你知道的,Origin.new 老提示 nilclass,下次再也不敢了。

我之前用的 django,给一个 model 起了个方法名叫 save()

然后每次我发现这玩意保存都要报错。。。。。。。。。。

klass 哈哈

每次命名之前都在 api 文档里搜索下看有没有重名的。。。

还可以起名为 attribute, 起名为 nil,然后发现更多惊喜 😄

我曾经脑抽给一个 model 取名 thread 然后 各种错

😄 ,之前写过 send、config 字段,也是各种错误,呵呵

我之前给一个 model 命名为 Type 😓 ,看着怪怪的,趁还没写多少强行改掉了。。

You need to Sign in before reply, if you don't have an account, please Sign up first.