Created
February 12, 2010 05:53
-
-
Save dnch/302344 to your computer and use it in GitHub Desktop.
accessing raw paperclip data
This file contains hidden or 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
| def _paperclip_is_csv(field_name) | |
| if attachment_for(field_name).dirty? | |
| begin | |
| FasterCSV.read(attachment_for(field_name).queued_for_write[:original].path) | |
| rescue FasterCSV::MalformedCSVError => e | |
| errors.add_to_base("Please ensure that the #{field_name.to_s.titleize} is a valid CSV file.") | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment