Check for _file_size & _content_type methods
Reported by Gregory Man | August 7th, 2008 @ 07:38 PM
Hi in commit 2ff75d116e886e7088e1542fc0f0ee464be53b5c u add check and raise error when filesize and contenttype fields don't exist, maybe better to check if model respond to this methods?
I don't want to store all this data in database, as before this comment i have defined this methods in my model. And it was work without database. Now i need to redefine column_names in my model, and this is not good think.
If u want i can write a patch.
Thank u.
Comments and changes to this ticket
-
-
Jon Yurek August 8th, 2008 @ 04:08 PM
This is a really good point. Shouldn't it also check for a setter, too? There are a bunch of places where paperclip sets attributes via model["attribute_name"] = ... syntax instead of calling methods, so I'm not sure how it would work there. Can you do a little more testing? Thanks.
-
Jon Yurek August 8th, 2008 @ 04:08 PM
- → State changed from new to open
-
Gregory Man August 8th, 2008 @ 06:16 PM
U right it's really need more tests.
But we have two ways to this work: 1. Use accessors, and not change plugin code, this will solve problems like mine (then u have huge table, and u don't want to change it)
- Change @instance[:"#{@name}filename"] to @instance.send(:"#{@name}filename=") in plugin code, and this will solve not only problem like mine, but much more for example u can define avatarfilename= method in model to write meaning in another cell, than u have database with different cell names for file_name (example: u work with php project on same db).
I prefer second, and what about u?
-
Jon Yurek November 15th, 2008 @ 11:34 AM
- → State changed from open to resolved
I've done this. I changed all the @instance[...] calls to wrappers called instance_read and instance_write.
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
