Skip to content

Instantly share code, notes, and snippets.

@dchandekstark
Last active August 29, 2015 13:55
Show Gist options
  • Save dchandekstark/8720423 to your computer and use it in GitHub Desktop.
Save dchandekstark/8720423 to your computer and use it in GitHub Desktop.
class HasContentValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
unless value.has_content?
record.errors[attribute] << "The \"#{value.dsid}\" datastream does not have content"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment