Hello everybody
I have some problems with an attachments.
I have the next model
class Profile < ActiveRecord::Base
belongs_to :user
before_create :set_default_icon
has_attached_file :icon, {
:url => “/
system/:class/:attachment/:id/:style_:basename.:extension”,
:styles => {
:big => Tog::Plugins.settings(:tog_social,
“profile.image.versions.big”),
:medium => Tog::Plugins.settings(:tog_social,
“profile.image.versions.medium”),
:small => Tog::Plugins.settings(:tog_social,
“profile.image.versions.small”),
:tiny => Tog::Plugins.settings(:tog_social,
“profile.image.versions.tiny”)
}}.merge(Tog::Plugins.storage_options)
has_attached_file :pdf, {
:url => “/
system/:class/:attachment/:id/:style_:basename.:extension”,
:path => “/
system/:rails_root/:public/:profile/:pdfs/:id/:style/:basename.:extension”
}.merge(Tog::Plugins.storage_options)
validates_attachment_content_type :pdf, :content_type =>
[ ‘application/pdf’, ‘application/msword’,
‘application/vnd.openxmlformats-
officedocument.wordprocessingml.document’ ],
:message => ‘Asegurese que el
fichero tiene la extensin .pdf o .doc’
end
When i put validates_attachment_content_type :pdf is obligatory that
i have to upload a file?
because if I only upload a photo then when i submit on my form fails
because i don’t update a pdf.
Can anyone help me?
thanks.