public
Description: Simple rails plugin that makes it easy to store uploaded files on Amazon S3
Clone URL: git://github.com/standout/s3storage.git
Fixed documentation and removed logger.warning
standout (author)
Wed Apr 23 13:48:26 -0700 2008
commit  dbc3bbc4d2b3deb6f7d81bed93b5761c2a42941e
tree    fcced0c029a2f81cae2f5b1e3d0451cbf51c6676
parent  808bd158b6ac3d06db051eec7e0a6f13cb39f848
0
...
16
17
18
19
 
 
 
 
 
20
21
22
...
46
47
48
49
 
50
51
52
 
53
54
55
56
 
 
57
58
59
...
16
17
18
 
19
20
21
22
23
24
25
26
...
50
51
52
 
53
54
55
 
56
57
58
 
 
59
60
61
62
63
0
@@ -16,7 +16,11 @@ Install the Amazon gem first
0
 
0
 Then you can install the plugin itself:
0
 
0
- ruby ./script/install plugin git://github.com/standout/s3storage.git
0
+ ruby ./script/plugin install git://github.com/standout/s3storage.git
0
+
0
+If you get a 'Not found' message, you probably don't have the latest version of
0
+rails. You could grab the plugin manually from http://github.com/standout/s3storage/tarball/master
0
+and extract it into your vendor/plugins folder.
0
 
0
 Your model needs to have the following fields for this to work.
0
 
0
@@ -46,14 +50,14 @@ end
0
 
0
 New document (app/views/document/new.html.erb):
0
 In your view, you'll need to have a form for uploading.
0
-<% form_tag ({:controller => 'documents', :action => 'create'}, {:multipart => true}) do %>
0
+<% form_for(@document, :html => {:multipart => true}) do |f| %>
0
   <p>
0
     <label for="document_title">Title</label><br />
0
- <%= text_field :document, :title %>
0
+ <%= f.text_field :title %>
0
   </p>
0
   <p>
0
- <label for="document_file">Pick a file to upload</label><br />
0
- <%= file_field :document, :file %> <!-- this is the important part -->
0
+ <label for="document_file">Select a file to upload</label><br />
0
+ <%= f.file_field :file %>
0
   </p>
0
   <%= submit_tag "Upload file" %>
0
 <% end %>
...
56
57
58
59
 
60
61
62
...
56
57
58
 
59
60
61
62
0
@@ -56,7 +56,7 @@ module Standout
0
 
0
         def save_the_file_to_s3
0
           if @file.nil?
0
- logger.warning "Error: File not attached?"
0
+ logger.info "Error: File not attached?"
0
             self.destroy
0
           else
0
             logger.info "Uploading to S3: #{@file.original_filename}"

Comments

    No one has commented yet.