Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Ensure required validations accepts subclasses #1515

Merged
merged 1 commit into from May 9, 2014

Conversation

quainjn
Copy link
Contributor

@quainjn quainjn commented Apr 11, 2014

Allow users to create a custom validator that inherits from the acceptable paperclip validators, and will prevent an error from being raised in that case.

class MyValidator < Paperclip::Validators::AttachmentContentTypeValidator
end

class MyModel < ActiveRecord::Base
  has_attached_file :attachment
  validates_with MyValidator, attributes: :attachment, content_type: 'image/jpeg'
end

sikachu added a commit that referenced this pull request May 9, 2014
Ensure required validations accepts subclasses
@sikachu sikachu merged commit be04cf0 into thoughtbot:master May 9, 2014
@sikachu
Copy link
Contributor

sikachu commented May 9, 2014

Thanks for the patch!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants