Commit 12bc18d2 by Pavel Forkert Committed by Jon Yurek

Allowed to refresh images of classes with namespaces.

parent 7ff4120e
......@@ -18,6 +18,13 @@ more detailed options.
The complete [RDoc](http://rdoc.info/gems/paperclip) is online.
Changes in this repo
------------
Allowed to refresh images of classes with namespaces. For example:
rake paperclip:refresh CLASS='User::Asset'
Requirements
------------
......
......@@ -4,8 +4,14 @@ def obtain_class
class_name
end
def obtain_class_from_class_name(class_name)
class_name.split('::').inject(Object) do |klass, partial_class_name|
klass.const_get(partial_class_name)
end
end
def obtain_attachments(klass)
klass = Object.const_get(klass.to_s)
klass = obtain_class_from_class_name(klass.to_s)
name = ENV['ATTACHMENT'] || ENV['attachment']
raise "Class #{klass.name} has no attachments specified" unless klass.respond_to?(:attachment_definitions)
if !name.blank? && klass.attachment_definitions.keys.include?(name)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment