2
当我在rails上使用ruby进行迁移时,我的数据似乎没有加载。在rails中迁移数据添加数据
任何人都可以看到问题吗?
class CreateAds < ActiveRecord::Migration
def self.up
create_table :ads do |t|
t.string :title
t.string :description
t.string :image
t.integer :price
t.string :featured
t.string :state
t.string :zipcode
t.boolean :is_public
t.boolean :is_activated
t.timestamp :expires_at
t.float :longitude
t.float :latitude
t.timestamps
end
Ad.create :title => "notice"
end
模型来源:
class Ad < ActiveRecord::Base
has_many :categories
belongs_to :user
end
后,我做rake db:migrate
。
谢谢!
是否有任何验证设置的,它可以在被创建失败的模式? – HBlend 2011-02-08 03:18:13
模型上的任何验证或类似内容? – macarthy 2011-02-08 03:21:00