Create the upload by calling Upload.create after that you can do @article.uploads << uploadyoujustcreated that would create the association On Mar 11, 2011 5:50 PM, "Frederick Cheung" <[email protected]> wrote: > > > On Mar 11, 11:44 pm, Luke <[email protected]> wrote: >> "file"=>#<ActionDispatch::Http::UploadedFile:0x000001050b4ea0 >> > > So you're probably passing the wrong thing to foo.uploads.create. > Unless you've overridden all sorts of crazy internal active record > stuff, rails is expecting the argument to that create method to be a > hash of attribute names to attribute values, whereas your just giving > it a file. > > Fred > > > > >> full parameters: >> >> Parameters: {"name"=>"Screenshot 2011-02-12 um 12.48.33.png", >> "authenticity_token"=>"PUhOOUAHLx+FUnuMI9jY7zwXXxId68v06MbyiImkaSM=", >> "file"=>#<ActionDispatch::Http::UploadedFile:0x000001050b4ea0 >> @original_filename="Screenshot 2011-02-12 um 12.48.33.png", >> @content_type="image/png", @headers="Content-Disposition: form-data; >> name=\"file\"; filename=\"Screenshot 2011-02-12 um >> 12.48.33.png\"\r\nContent-Type: image/png\r\n", >> @tempfile=#<File:/var/folders/fn/fnhQ4mIBGqO3kQnHeiVzD++++TI/-Tmp-/RackMult ipart20110312-5746-19c2n8j>>, >> "id"=>"1"} > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to [email protected]. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. >
-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

