validates_uniqueness_of :你要驗證的屬性, :message => "國家代碼重複"
validates_length_of :你要驗證的屬性, :in => 3..15, :message => "用戶名長度須爲3到15位字母或數字"
attr_accessor :password1
attr_accessor :password1_confirmation
validates_confirmation_of :password1, :message => "確認密碼不一致!"validates_presence_of :password, :message => "密碼不能爲空!"
validates_format_of :你要驗證的屬性 ,
:with => %r{.(jpg|gif|png)$}i ,
:message => "圖片格式必須爲 .jpg 或 .gif 或 .png 格式."
validates_numericality_of :orderby, :only_integer => true, :message => "順序號必須是數值!"
validates_numericality_of :你要驗證的屬性,:message => "必須是數字!", :only_integer => true