【发布时间】:2011-06-06 04:22:44
【问题描述】:
我是 ruby on rails 的新手,谁能解释一下符号 ':' 是什么意思,'validates' 和 'create_table' 是什么意思?好纠结……
class Post < ActiveRecord::Base
validates :name, :presence => true
validates :title, :presence => true, :length => {:minimum => 5}
end
class CreatePosts < ActiveRecord::Migration
def change
create_table :posts do |t|
t.string :name
t.string :title
t.text :content
t.timestamps
end
end
end
【问题讨论】: