markevans / dragonfly

A Ruby gem for on-the-fly processing - suitable for image uploading in Rails, Sinatra and much more!
http://markevans.github.io/dragonfly
MIT License
2.12k stars 244 forks source link

fallback hook if datastore returns not found #405

Open markevans opened 9 years ago

markevans commented 9 years ago

the user potentially could configure a fallback datastore, or placeholder content, or whatever

wpiekutowski commented 9 years ago

How do you envision this to work? Would a block be the most preferable solution?

not_found_fallback do
  datastore :s3,
    bucket_name: 'my-bucket',
    access_key_id: 'blahblahblah',
    secret_access_key: 'blublublublu'
  # or maybe the datastore should be called here manually and just return a string to the fallback file?
end
not_found_fallback do |request|
  '/path/to/placeholder' # or some code that takes a look at the request and returns valid String
end