lib/scribd-carrierwave.rb in scribd-carrierwave-0.1.2 vs lib/scribd-carrierwave.rb in scribd-carrierwave-0.1.3
- old
+ new
@@ -9,12 +9,13 @@
def included(base)
base.extend ClassMethods
end
def upload uploader
+
file_path = full_path(uploader)
- args = { file: file_path, access: 'private' }
+ args = { file: file_path, access: ( uploader.class.public? ? 'public' : 'private' )}
type = File.extname(file_path)
if type
type = type.gsub(/^\./, '').gsub(/\?.*$/, '')
args.merge!(type: type) if type != ''
@@ -35,13 +36,20 @@
uploader.root + uploader.url
end
end
module ClassMethods
- def has_ipaper
+
+ def public?
+ @public
+ end
+
+ def has_ipaper(public = false)
include InstanceMethods
after :store, :upload_to_scribd
before :remove, :delete_from_scribd
+
+ @public = !!public
end
end
module InstanceMethods
def self.included(base)