Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

scafffold, 1st column value is wrong

#1529

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

Reported by Horace Ho · December 8th, 2008 @ 08:10 AM

State: invalid
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Frederick Cheung
    Frederick Cheung
    • 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

    December 8th, 2008 @ 10:47 AM