This project is archived and is in readonly mode.

#1529 ✓invalid
Horace Ho

scafffold, 1st column value is wrong

Reported by Horace Ho | December 8th, 2008 @ 08:10 AM | in 2.x

1 create a project

2 script/generate scaffold Phone type:string maker:string

3 rake db:migrate

4 open http://localhost:3000/phones in a browser enter "Smart" in Type, and "Apple" and Maker, click create http://localhost:3000/phones/1 will show

Phone was successfully created. Type: Phone Maker: Apple

  • notice the Type: Phone should be Type: Smart

The 1st column value (wrongly) shows the scaffold model name.

Ruby version 1.8.6 (universal-darwin9.0) RubyGems version 1.3.1 Rails version 2.2.2 Active Record version 2.2.2 Action Pack version 2.2.2 Active Resource version 2.2.2 Action Mailer version 2.2.2 Active Support version 2.2.2 Application root /Users/horace/Projects/Web/Testing Environment development Database adapter sqlite3

Comments and changes to this ticket

  • Frederick Cheung

    Frederick Cheung December 8th, 2008 @ 10:47 AM

    • State changed from “new” to “invalid”

    Type is a "magic" column for activerecord, used for single table inheritance (and slightly magic for ruby too, since Object#type is a deprecated alias for Object#class). With single table inheritance the type column is used for storing what the class of the object is so what you are seeing is normal.

    Pick a different column name or use set_inheritance_column to tell activerecord not to use the type column for this purpose

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket