thoughtbot / paperclip

Easy file attachment management for ActiveRecord
https://thoughtbot.com
Other
9.01k stars 2.43k forks source link

Style deletes keys from the hash on initialization #137

Closed angelic closed 13 years ago

angelic commented 14 years ago

This causes problems so later instances of the same object aren't able to initialize with those keys. This affects :geometry, :format, and :processors.

Fix is here: angelic/paperclip@ec63aca937568005f0534fd6be90c051b8c316da Branch: http://github.com/angelic/paperclip/tree/issue_137

bikerduweb commented 14 years ago

Thanks for this patch angelic: you saved my day ;-)

sbfaulkner commented 14 years ago

argh... thanks for confirmation of my own findings

sbfaulkner commented 14 years ago

functionally equivalent patch in: http://github.com/sbfaulkner/paperclip/commit/b33f1c10a09dd680e8d65e2d73dcbf9c794cb757

and a test in: http://github.com/sbfaulkner/paperclip/commit/cf5bc5ec81eb76912deb7a522c4649125caddb5e

drodriguez commented 14 years ago

I was going mad trying to figure out why my :geometry was missing after reloading my classes (something very common on development).

I have defined my styles hash in a constant in a initializer, and I use it for several attachment models. After sending an attachment to one of them, the rest where not getting the :geometry value.

My external solution (not patching Paperclip, I mean) is to create a method that returns the literal hash, instead of a constant. It works for me without problems.

drodriguez commented 14 years ago

Correction: my alternative fix doesn't work in production.

sbfaulkner commented 14 years ago

155 and #238 duplicate the problem

sikachu commented 13 years ago

This has been fixed in 56d6b2402d553a505f29eaeb022d4a6900fda8fa. :)