Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Reflection and removal of attachment_definitions #1268

Closed
the8472 opened this issue Jun 26, 2013 · 4 comments
Closed

Reflection and removal of attachment_definitions #1268

the8472 opened this issue Jun 26, 2013 · 4 comments

Comments

@the8472
Copy link

the8472 commented Jun 26, 2013

With dad6086 the only registry of paperclip attachments for each class was removed.

How are things doing reflection (automatically building UIs, serialization, ...) supposed to find all paperclip attachments for a class now? I see that there is Paperclip::Tasks::Attachments.names_for(klass) now, but this only seems to be intended for rake tasks as its namespace suggests.

@the8472
Copy link
Author

the8472 commented Jun 26, 2013

Same with 40bdd3d, it removes attachment_for(field), which is a useful method to only access attachment objects instead of an arbitrary send(), which needs extra checking that we're not send()-ing evil things.

@ScotterC
Copy link
Contributor

What's the best way to get the paperclip attachment options for a given class now. I'd like to get Delayed Paperclip up to speed quickly but it was fully dependent on #attachment_defintions.

@johnnyshields
Copy link
Contributor

From paperclip-dimension gem:

      begin
        # new syntax (version > 3.4.2, commit on 2013-06-14)
        opts = ::Paperclip::Tasks::Attachments.definitions_for(self.class)[name]
      rescue
        # old syntax (version <= 3.4.2)
        opts = self.class.attachment_definitions[name]
      end

Please let me know if there's a better way to do it.

@jyurek
Copy link

jyurek commented Jul 30, 2013

I've reinstated the attachment_definitions method with dbb7e04, as seen in #1300, and I'm going to push this as 3.5.1 soon, so you shouldn't have to do anything. I'll be coming up with a good permanent API for it soon and will let you know.

@jyurek jyurek closed this as completed Jul 30, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants