rails bug 如果表字段有名字为type的bug

  今天在做开发的时候遇到一个莫名奇妙的问题,后来才发现是表中有字段名字叫type引起的,还是在http://dev.rubyonrails.org/ticket/7998 上发现原来是rails的一个bug,发出来,免得大家遇到相同的问题。

Ticket #7998 (new defect)

Opened 2 months ago

Last modified 2 weeks ago

Scafford should detect & report error when DB field named 'type'

Reported by:dlametAssigned to:core
Priority:normalMilestone:1.x
Component:ActiveRecordVersion:edge
Severity:normalKeywords:field name error tINTEGER
Cc:   

Description

When generating a scaffold, it will accept a table that has a field named type. This causes a crypic error inside base.rb:

compile error c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1358: syntax error, unexpected tINTEGER Object::1

It would save a lot of people (like me) a lot of time if the scaffold code would fail with a useful error about the field name being 'type'.

Change History

05/22/07 00:51:47 changed by mlopes

I would like to second that. I just came across the exact same problem and for a newbie it can be really a cumbersome issue.

A warning should be used whenever a field name type exists. Better yet, it shouldn't be a problem at all.

05/29/07 20:37:33 changed by josh

  • type changed from enhancement to defect.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值