This repository has been archived by the owner on Jul 13, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a helper that creates the Paperclip columns
This can be used in migrations, i.e. create_table :users do |t| t.has_attached_file :avatar end (three commits squashed into one by Alexey Mahotkin <squadette@gmail.com>)
- Loading branch information
Showing
3 changed files
with
18 additions
and
8 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module Paperclip | ||
module Schema | ||
def has_attached_file(name) | ||
column :"#{name}_file_name", :string | ||
column :"#{name}_content_type", :string | ||
column :"#{name}_file_size", :integer | ||
column :"#{name}_updated_at", :datetime | ||
end | ||
end | ||
end |