lib/dir_model/export.rb in dir_model-0.3.3 vs lib/dir_model/export.rb in dir_model-0.3.4
- old
+ new
@@ -43,10 +43,13 @@
@generated = true
end
def ensure_extension(file_path, file_method_name)
file_path_with_extension = file_path
- if File.extname(file_path).blank?
+
+ if self.respond_to?("#{file_method_name}_extension")
+ file_path_with_extension = file_path + '.' + self.public_send("#{file_method_name}_extension")
+ elsif File.extname(file_path).blank?
if ext = FastImage.type(self.public_send(file_method_name))
file_path_with_extension = file_path + '.' + ext.to_s
else
raise StandardError.new("options :name should provid an extension")
end