Created
April 12, 2010 14:16
-
-
Save digitalpulp/363600 to your computer and use it in GitHub Desktop.
This file contains 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
.row= file_field_tag "page[parts_attributes][#{page_part_counter}][document]" | |
- if page_part.document.file? | |
.row= page_part.document.original_filename |
This file contains 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
class FilePagePart < PagePart | |
has_attached_file :document | |
def render_content | |
self.document.url | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A page part for basic file uploads using Paperclip. Custom page parts consist of a model and a view partial used for the page-edit form.
In this case, the form elements are simply a file field and, if we already have a saved file, its filename. Note the
render_content
method: when this part is rendered, it will output the path to its file.