【发布时间】:2010-02-26 04:50:39
【问题描述】:
所以我正在尝试用 Ruby 粗略设计一个设计,所以我运行了
ruby script/generate scaffold item name:string description:text model:string manufacturers_name:string category:string weight:decimal upc:string ebay_cat_id:string blacklist:bool in_discovery:bool archived:bool
唯一的问题是模型上没有布尔字段。如果我使用 ruby script/consol 并运行
item = Item.new
我明白了
#<Item id: nil, name: nil, description: nil, model: nil, manufacturers_name: nil, category: nil, weight: nil, upc: nil, ebay_cat_id: nil, created_at: nil, updated_at: nil>
对象上显示的字段数量是否有限制?我知道这些字段是在数据库中创建的...仔细检查一下。
想想日期时间戳也不在对象上。对我有什么提示吗?我必须为这些手动编写访问器还是什么?
【问题讨论】:
标签: ruby-on-rails activerecord sqlite