Guest User

Untitled

a guest
Nov 24th, 2014
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. Parameters: {"utf8"=>"✓", "authenticity_token"=>"s0SqCQwVBFYYZudSRZ30/2fw4U1iiNPHqKe/8WI7lhI=", "doc"=>{"title"=>"asdasdd", "a"=>#<ActionDispatch::Http::UploadedFile:0x007fc313302e28 @tempfile=#<Tempfile:/var/folders/kq/j_tktbwx2m71cw2s6hm09rpw0000gn/T/RackMultipart20141124-23307-96wq57>, @original_filename="Untitled 2.numbers", @content_type="application/octet-stream", @headers="Content-Disposition: form-data; name=\"doc[a]\"; filename=\"Untitled 2.numbers\"\r\nContent-Type: application/octet-stream\r\n">}, "commit"=>"Create"}
  2.  
  3.  
  4.  
  5. ---------
  6.  
  7.  
  8. form
  9.  
  10. <%= form_for @doc, :html => {:multipart => true} do |f| %>
  11. <p><%= f.text_field :title %></p>
  12. <p><%= f.file_field :data_file %></p>
  13.  
  14. <%= f.submit "Create" %>
  15.  
  16. <% end %>
  17.  
  18.  
  19.  
  20. ------
  21.  
  22. class Doc < ActiveRecord::Base
  23. belongs_to :course
  24. mount_uploader :data_file, DocFileUploader
  25. end
  26.  
  27.  
  28. -------
  29. create_table "docs", force: true do |t|
  30. t.string "title"
  31. t.string "path"
  32. t.datetime "created_at"
  33. t.datetime "updated_at"
  34. t.string "data_file"
  35. end
Advertisement
Add Comment
Please, Sign In to add comment