Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #7998 (new defect)

Opened 2 years ago

Last modified 2 years ago

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

Reported by: dlamet Assigned to: core
Priority: normal Milestone: 2.x
Component: ActiveRecord Version: edge
Severity: normal Keywords: 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.