lib/papermill/papermill.rb in papermill-1.1.6 vs lib/papermill/papermill.rb in papermill-1.2.0
- old
+ new
@@ -1,16 +1,23 @@
module Papermill
- PAPERCLIP_INTERPOLATION_STRING = ":id_partition/:style/:basename.:extension"
def self.included(base)
base.extend(ClassMethods)
end
def self.options
@options ||= BASE_OPTIONS.deep_merge(defined?(OPTIONS) ? OPTIONS : {})
end
+ def self.compute_paperclip_path
+ path = []
+ path << (options[:use_id_partition] ? ":id_partition" : ":id")
+ path << (":url_key" if options[:use_url_key])
+ path << ":style"
+ path << ":basename.:extension"
+ path.compact.join("/")
+ end
module ClassMethods
attr_reader :papermill_associations
def papermill(*args)
@@ -34,11 +41,11 @@
end
scope = scope.scoped(options.shift) if options.first
scope
end
end
- ActionController::Dispatcher.middleware.delete(FlashSessionCookieMiddleware) rescue nil
- ActionController::Dispatcher.middleware.insert_before(ActionController::Base.session_store, FlashSessionCookieMiddleware, ActionController::Base.session_options[:key]) rescue nil
+ ActionController::Dispatcher.middleware.delete(FlashSessionCookieMiddleware) rescue true
+ ActionController::Dispatcher.middleware.insert_before(ActionController::Base.session_store, FlashSessionCookieMiddleware, ActionController::Base.session_options[:key]) rescue true
end
def inherited(subclass)
subclass.instance_variable_set("@papermill_associations", @papermill_associations)
super