lib/papermill/papermill_asset.rb in BBenezech-papermill-0.3.0 vs lib/papermill/papermill_asset.rb in BBenezech-papermill-0.4.0
- old
+ new
@@ -1,10 +1,7 @@
-require "acts_as_list"
-require "paperclip"
-
class PapermillAsset < ActiveRecord::Base
- acts_as_list :scope => 'assetable_key=\'#{assetable_key.simple_sql_sanitizer}\' AND assetable_id=#{assetable_id} AND assetable_type=\'#{assetable_type}\''
+ acts_as_list :scope => 'assetable_key=\'#{assetable_key.to_s.simple_sql_sanitizer}\' AND assetable_id=#{assetable_id} AND assetable_type=\'#{assetable_type}\''
belongs_to :assetable, :polymorphic => true
before_destroy :destroy_files
named_scope :key, lambda { |key| { :conditions => { :assetable_key => key } } }
@@ -46,13 +43,9 @@
file_content_type && file_content_type.split("/")
end
def image?
content_type && content_type.first == "image" && content_type[1]
- end
-
- def interpolated_path(with = {}, up_to = nil)
- Papermill::papermill_interpolated_path({":id_partition" => self.id_partition}.merge(with), up_to)
end
# before_filter
def destroy_files
system "rm -rf #{Papermill::papermill_interpolated_path({":id_partition" => self.id_partition}, ':id_partition')}/" if image?