attachinary
attachinary copied to clipboard
Validate presence error message
I have the following in my model:
class Cv < ActiveRecord::Base
has_attachment :attachment, accessible: false
validates :attachment, presence: true
If I attempt a save via form submit with no attachment, I see "Attachment files" as my error message. When I pry on the page, I see
[2] pry(#<#<Class:0x007fed94403ad8>>)> @cv.errors
=> #<ActiveModel::Errors:0x007fed851a2348
@base=
#<Cv:0x007fed7fe1a770
id: nil,
...>
@messages={:attachment_files=>[""]}>
and @cv.errors.full_messages => ["Attachment files "].
When I'm in the console, however, I see c.errors.full_messages => ["Attachment can't be blank"].
I would like to override the error message and cannot seem to do so with locales or validates :attachment, presence: { message: 'Testing' }.