Skip to content

Instantly share code, notes, and snippets.

@liwh
Created September 3, 2010 02:50
Show Gist options
  • Save liwh/563328 to your computer and use it in GitHub Desktop.
Save liwh/563328 to your computer and use it in GitHub Desktop.

1.验证字段的时候,如果允许为空值得加上:allow_nil => true,如:

:validates_length_of :content,:maxinum => 200
#直接用modelname.create(:content=> nil)会出错,得加上:allow_nil => true

2.fixtures里面,如果某字段值设置为ture,在mysql 里显示的是1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment