lib/lockbox/carrier_wave_extensions.rb in lockbox-0.1.1 vs lib/lockbox/carrier_wave_extensions.rb in lockbox-0.2.0
- old
+ new
@@ -34,10 +34,24 @@
end
private
define_method :lockbox do
- @lockbox ||= Utils.build_box(self, options)
+ @lockbox ||= begin
+ table = model ? model.class.table_name : "_uploader"
+ attribute =
+ if mounted_as
+ mounted_as.to_s
+ else
+ uploader = self
+ while uploader.parent_version
+ uploader = uploader.parent_version
+ end
+ uploader.class.name.sub(/Uploader\z/, "").underscore
+ end
+
+ Utils.build_box(self, options, table, attribute)
+ end
end
end
end
end
end