Hi,
I have a doubt that how to validate in attachment_fu when 2 different
file formats(Image/Document) are used.
I have a model named Image, Documents ,
class Images < ActiveRecord::Base
has_many :attachments, :as => :parent
end
class Documents < ActiveRecord::Base
has_many :attachments, :as => :parent
end
class Attachments < ActiveRecord::Base
belongs_to :parent, :polymorphic => true
has_attachment :storage => :file_system,
:path_prefix => ‘public/attachments’,
:size => 0.kilobytes…5000.kilobytes,
:max_size => 5000.kilobytes,
:content_type =>
[‘application/pdf’,‘application/vnd.openxmlformats-officedocument.presentationml.presentation’,‘application/vnd.ms-powerpoint’,
‘application/msword’, ‘text/plain’,:image]
validates_as_attachment
end
I am uploading Image from the a view file, validation should be made
only for the Image. Please help how can i make the validation for image
& document seperately.