Ced*_*gas 2 ruby activerecord ruby-on-rails ruby-on-rails-3
当我在rails上使用ruby进行迁移时,我的数据似乎没有加载.
有谁能看到这个问题?
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
Run Code Online (Sandbox Code Playgroud)
型号来源:
class Ad < ActiveRecord::Base
has_many :categories
belongs_to :user
end
Run Code Online (Sandbox Code Playgroud)
之后,我做rake db:migrate.
谢谢!