Documents Not Converting Properly in Scribd
-
jaredbrown (at gmail)
require 'paperclip'
class Resume < ActiveRecord::Base
belongs_to :user belongs_to :city has_many :top_resume_locations has_many :top_resume_referrers has_one :total_resume_view has_one :total_introduction has_many :daily_resume_views has_many :resume_views belongs_to :categoryhas_attached_file :document,
:storage => :s3, :s3_credentials => "#{RAILS_ROOT}/config/amazon_s3.yml", :path => ":attachment/:id/:filename", :bucket => 'talentopoly-resumes'#validates_attachment_presence :video #validates_attachment_content_type :data, :content_type => 'image/jpeg', :message => "has to be in jpeg format" has_ipaper_and_uses 'Paperclip'
validates_length_of :vanity, :within => 4..40 validates_format_of :vanity, :with => /^[a-z0-9]*$/i validates_uniqueness_of :vanity, :case_sensitive => false, :allow_nil => false, :allow_blank => false validates_presence_of :location validates_presence_of :summary validates_presence_of :experience validates_presence_of :education validates_length_of :location, :within => 0..255 validates_presence_of :city_id validates_presence_of :category_id validates_presence_of :titles end
-
jaredbrown (at gmail)
It appears the issue is the cache-busting ?1277580374 at the end.
The following line in paperclip.rb needs to strip the ?1277580374 off if attached_file.url is used.
attached_file.url =~ ScribdFu::S3 ? attached_file.url : attached_file.path
-
jaredbrown (at gmail)
Returns the full filename for the given attribute. If the file is
stored on S3, this is a full S3 URI, while it is a full path to the
local file if the file is stored locally.
def file_path
if attached_file.url =~ ScribdFu::S3pos = attached_file.url.rindex('?') pos > 0 ? attached_file.url[0, pos] : attached_file.urlelse
attached_file.pathend end
-
Matt Darby
- State changed from new to open
Odd. What version of Rails are you using? I've never noticed the "cache string" being appended to S3 URLs before?
-
jaredbrown (at gmail)
rails 2.3.5
thoughtbot-paperclip 2.3.1
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.