Created
August 26, 2014 16:02
-
-
Save javan/a191389b710cd6f96eba to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Document < ActiveRecord::Base | |
columns.select { |c| c.limit && c.type.in?([:string, :text]) }.each do |column| | |
validates_length_of column.name, maximum: column.limit, tokenizer: ->(string) { string.bytes } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment