开发者

Ruby On Rails ActiveRecord model not showing "blacklist" field

So I'm trying to rough out a design in Ruby, and so I ran

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

The only problem is that none of the bool fields are on the model. If I use ruby script/consol and run

item = Item.new

I get

#<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: 开发者_Go百科nil>

Is there a limit to how many fields it will show on the object? I know the fields were created in the database... double checked that.

Come to think of it the date timestamps aren't on the object either. Any hints for me? Do I have to manually write accessors for these or what?


Have you tried:

blacklist:boolean

It looks like you must declare the full name, the docs say:

Instantiates a new column for the table. The type parameter is normally one of the migrations native types, which is one of the following: :primary_key, :string, :text, :integer, :float, :decimal, :datetime, :timestamp, :time, :date, :binary, :boolean.

Just like you cannot use int, you must declare integer

To answer the second part of your question, Yes! there is a limit to the number of columns you may have, 4096.

It's likley that once the interpreter hit "bool" it nixed the latter column names and types, that is why you're probably missing your timestamps and what not.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜