The `:file_name` option set to lambda should accept the model instance as argument
y9v opened this issue · 0 comments
y9v commented
The current support for lambda function set to a :file_name
option is not very handy, since it has no access to the current modal instance. You can use dynamic things like current time for the filename, and that's basically it.
Let's make this option a bit more useful for the users:
class Product
mount_base64_uploader :image, SomeUploader, file_name: -> (p) { p.slug }
end
This could be implemented by currying the lambda function with the model instance in lib/carrierwave/base64/adapter.rb:14