README.md in paperclip_private-0.0.2 vs README.md in paperclip_private-0.0.3

- old
+ new

@@ -8,18 +8,19 @@ +Ex: +```ruby +mount PaperclipPrivate::Engine => 'paperclip/' +``` + -+In your ApplicationController add the method `paperclip_whitelist` which returns an array of the models with attachments you would like to serve privately. -+Ex: ++You have to register class names and their attachments with the whitelist registry. This can happen in the controller or in config/paperclip_private.rb ++The following example would whitelist the class PrivateAttachment's file: +```ruby -+def paperclip_whitelist -+ [PrivateAttachment] -+end ++require 'paperclip_private' ++PaperclipPrivate::Whitelist.register({PrivateAttachment: :file}) +``` ++You can also pass an array of names like `{PrivateAttachment: [:file, :avatar]}`. + -+Then in your model add `privacy: :private` to the has_attached_file options. Then add the method `can_download_attachment?`. ++Then in your model add `privacy: :private` to the has_attached_file options. This can also accept a lambda that gets passed the attachment instance and expects back either `:private` or `:public`. ++Then add the method `can_download_attachment?`. +The method `can_download_attachment?` gets passed the controller instance and the params and is expected to return true, false, or raise Paperclip::Errors::AccessDeniedError. +The controller is passed so that methods like current_user can be run on it to get the user instance for validation puprposes. Duplicated params gets passed to do things like allow anyone if the style is :thumb or to only allow :original to paid users. +Ex: +```ruby + has_attached_file :file, privacy: :private