Skip to content

Instantly share code, notes, and snippets.

@chucker34
Created November 6, 2014 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chucker34/f1c9f8d3d3dda7d6ba02 to your computer and use it in GitHub Desktop.
Save chucker34/f1c9f8d3d3dda7d6ba02 to your computer and use it in GitHub Desktop.
validation
class Code < ActiveRecord::Base
validates :limit,
allow_blank: true,
format: { with: /\A(\d{4})-(\d{1,2})-(\d{1,2})\z/, message: "は2015-01-01の形式で入力してください" }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment