Created
June 22, 2015 03:41
-
-
Save danielfone/856bbaafc2e00bfdcab3 to your computer and use it in GitHub Desktop.
Attachinary monkey patch Rails 4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Attachinary | |
| module Utils | |
| Rails.logger.warn 'Monkey patched Attachinary::Utilss#process_hash' | |
| def self.process_hash(hash, scope=nil) | |
| file = if hash['id'] | |
| Attachinary::File.find hash['id'] | |
| else | |
| file = Attachinary::File.new hash.slice('public_id', 'version', 'width', 'height', 'format', 'resource_type') | |
| file.scope = scope.to_s if scope && file.respond_to?(:scope=) | |
| file | |
| end | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment