Displaying 7 results from an estimated 7 matches for "validates_attachment_content_typ".
Did you mean:
validates_attachment_content_type
2011 Mar 17
1
Paperclip validates_attachment_content_type not working?
Hi,
I''m using the paperclip gem to upload photos.
I''m trying to use the content-type validator in my photo-model but
it''s not working.
Photo upload with just the file-size validator works.
What could this be?
Here''s my code:
http://pastebin.com/1nGfgmtN
Thanks,
Mathew
--
You received this message because you are subscribed to the Google Groups "Ruby on
2010 Mar 17
3
Associating a default paperclip image from a different model
...=> { :original => ''57x57'' },
:default_url => ''/images/football.png''
# has_attached_file :image,
# :styles => { :original => ''57x57'' },
# :default_url => self.country.flag.url
validates_attachment_content_type :image, :content_type =>
[''image/png''], :message => "only pngs are allowed."
validates_presence_of :title
validates_length_of :title, :within => 3..50
validates_presence_of :url
end
I have a Country model also which has a flag (paperclip attached
image)....
2013 Oct 10
12
What's the best way to approach reading and parse large XLSX files?
...t;,
:path=>":rails_root/tmp/users/uploaded_files/material_list/material_list.:extension"
validates_attachment_presence :material_list
accepts_nested_attributes_for :material_list, :allow_destroy => true
accepts_nested_attributes_for :inventory, :allow_destroy => true
validates_attachment_content_type :inventory, :content_type =>
["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
:message => "Only .XSLX files are accepted as Inventory"
validates_attachment_content_type :material_list, :content_type =>
["application/vnd.openxmlformats-of...
2012 Aug 18
2
Paperclip images are not stored in my directory
...:url => "/assets/users/:id/:style/:basename.:extension",
:path =>
":rails_root/public/assets/users/:id/:style/:basename.:extension"
validates_attachment_presence :photo
validates_attachment_size :photo, :less_than => 5.megabytes
validates_attachment_content_type :photo, :content_type => [''image/jpeg'',
''image/png'']
Please advice me...
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5T...
2014 Feb 18
0
How to Test Multimodel Paperclip attachments?
...ust upload at least
one image' }
accepts_nested_attributes_for :uploads, allow_destroy: true
end
Upload.rb
class Upload < ActiveRecord::Base
belongs_to :car
has_attached_file :upload, styles: { medium: '300x300>', thumb:
'100x100>' }
validates_attachment_content_type :upload, content_type:
/\Aimage\/.*\Z/
validates_attachment_presence :upload
end
As you can see there is a has_many and belongs_to relationship between
the two.
car_spec.rb
require 'spec_helper'
describe Car do
before do
@car = Car.new(FactoryGirl.attrib...
2010 Aug 18
0
paper clip plugin validation fails
...mat.xml { render :xml => @image.errors, :status =>
:unprocessable_entity }
puts"hiiiiiiiiiiiiiiiiii"+@image.errors.inspect
end
#puts"check the srrors are"+@image.errors.inspect
responds_to_parent { render }
end
here is the model validation
validates_attachment_content_type :picture,
:content_type=>[''image/jpeg'', ''image/png'', ''image/gif''], :message =>
:missing_content_type
or
validates_format_of :picture,:allow_blank=>true, :with =>
%r{\.(gif|jpg|png|jpeg|bmp)$}i,:message =&g...
2011 Jun 01
7
desperate, errors with file upload
...''
/usr/lib/phusion_passenger/passenger-spawn-server:61
[3]
has_attached_file :upload,
:styles => { :thumb => { :geometry => "200x200>",
:format => :png }},
:whiny => false
validates_attachment_content_type :upload,
:content_type => [''image/jpeg'',
''image/png'',
''image/gif'',
''image/...