Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added upload extractor and updated docs
- Loading branch information
Daniel Tenner
committed
Mar 14, 2009
1 parent
ccfcd1e
commit 651098e
Showing
4 changed files
with
76 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
|
||
ActiveRecord::Base.send(:extend, NumFu::ActMethods) | ||
ActiveRecord::Base.send(:extend, NumFu::ActMethods) |
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,17 @@ | ||
module NumFu | ||
module UploadExtractor | ||
|
||
# Determine whether the upload is via Nginx Upload Module or not, and if so, transmogrify it to be | ||
# in a standard form that can be passed on to InstanceMethods#uploaded_data= | ||
def extract_upload(name="file") | ||
if params["#{name}.path"] | ||
fake_upload_data = FakeUploadData.new | ||
fake_upload_data.path = params["#{name}.path"] | ||
fake_upload_data.original_filename = params["#{name}.original_filename"] | ||
fake_upload_data.content_type = params["#{name}.content_type"] | ||
params["#{name}"][:uploaded_data] = fake_upload_data | ||
end | ||
end | ||
|
||
end | ||
end |