fabrik42/acts_as_api — Issue #47: Using acts_as_api with Paperclip
Author: adampash
Created: 2011-12-01 04:48:05+00:00
State: open

First, thanks so much for acts_as_api—very useful!

I'm trying to use it with Paperclip, but I'm having some trouble. I have a model with:

has_attached_file :attachment

And I'd like to be able to include :attachment in my acts_as_api template (template.add :attachment)

Attempting to do so like that gives me the following error:

SystemStackError (stack level too deep):
app/controllers/rooms_controller.rb:34:in `show'
app/controllers/rooms_controller.rb:32:in `show'

Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.1.0/lib/action_dispatch/middleware/templates/rescues/_trace.erb (134.8ms)
Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.1.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.3ms)
Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.1.0/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (154.1ms)

So clearly just adding :attachment to the template and hoping it'll magically work didn't pan out! Any ideas/suggestions for how I might tackle this? With paperclip, I can access different sizes of an uploaded image, for example, using something like @message.attachment(:large) (where @message is an object with has_attached_file and :large is one of the Paperclip-resized versions of the image).

Thanks!