This repository has been archived by the owner on Jul 13, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Push attachment definitions into a list of attachments for the rake task
- Loading branch information
1 parent
710f658
commit d687fca
Showing
5 changed files
with
60 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
require 'singleton' | ||
|
||
module Paperclip | ||
module Tasks | ||
class Attachments | ||
include Singleton | ||
|
||
def self.add(klass, attachment_name, attachment_options) | ||
instance.add(klass, attachment_name, attachment_options) | ||
end | ||
|
||
def self.names_for(klass) | ||
instance.names_for(klass) | ||
end | ||
|
||
def self.definitions_for(klass) | ||
instance.definitions_for(klass) | ||
end | ||
|
||
def add(klass, attachment_name, attachment_options) | ||
@attachments ||= {} | ||
@attachments[klass] ||= {} | ||
@attachments[klass][attachment_name] = attachment_options | ||
end | ||
|
||
def names_for(klass) | ||
@attachments[klass].keys | ||
end | ||
|
||
def definitions_for(klass) | ||
@attachments[klass] | ||
end | ||
end | ||
end | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
require 'paperclip/tasks/attachments' | ||
|
||
module Paperclip | ||
module Task | ||
def self.obtain_class | ||
|
This file contains 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