[Rails] Re: A file-upload suddenly seems to be nil

2011-03-13 Thread Luke
Thanks! One last question though, how would the constructor signature look for that. Apperently def initialize(file) # do stuff end doesn't work -- 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

[Rails] Re: A file-upload suddenly seems to be nil

2011-03-13 Thread Frederick Cheung
On Mar 13, 2:12 pm, Luke kickingje...@gmail.com wrote: Thanks! One last question though, how would the constructor signature look for that. Apperently I wouldn't override the initialiser if I were you. You need to preserve existing semantics so that (for example) active record can load your

Re: [Rails] Re: A file-upload suddenly seems to be nil

2011-03-12 Thread Luke
Thanks! -- 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 rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options,

[Rails] Re: A file-upload suddenly seems to be nil

2011-03-12 Thread Luke
That was the problem, thanks a lot! I changed it to @upload = Upload.new @upload.file = params[:file] @upload.save! @article.uploads @upload works like a charm. @upload.file = params[:file] works because I'm using carrierwave to manage uploads. However, I'm wondering how you have to write

[Rails] Re: A file-upload suddenly seems to be nil

2011-03-12 Thread Frederick Cheung
On Mar 12, 1:58 pm, Luke kickingje...@gmail.com wrote: That was the problem, thanks a lot! I changed it to @upload = Upload.new @upload.file = params[:file] @upload.save! @article.uploads @upload works like a charm. @upload.file = params[:file] works because I'm using carrierwave to

[Rails] Re: A file-upload suddenly seems to be nil

2011-03-11 Thread Frederick Cheung
On Mar 11, 10:33 pm, Luke kickingje...@gmail.com wrote: where line 95 is @article.uploads.create(params[:file]) if I remove the parameter no errors get thrown. But the console tells me params[:file] DOES exists and has proper values. Also params[:file] worked great before I used the

[Rails] Re: A file-upload suddenly seems to be nil

2011-03-11 Thread Luke
file=#ActionDispatch::Http::UploadedFile:0x01050b4ea0 full parameters: Parameters: {name=Screenshot 2011-02-12 um 12.48.33.png, authenticity_token=PUhOOUAHLx+FUnuMI9jY7zwXXxId68v06MbyiImkaSM=, file=#ActionDispatch::Http::UploadedFile:0x01050b4ea0 @original_filename=Screenshot

[Rails] Re: A file-upload suddenly seems to be nil

2011-03-11 Thread Frederick Cheung
On Mar 11, 11:44 pm, Luke kickingje...@gmail.com wrote: file=#ActionDispatch::Http::UploadedFile:0x01050b4ea0 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

Re: [Rails] Re: A file-upload suddenly seems to be nil

2011-03-11 Thread Jazmin
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 frederick.che...@gmail.com wrote: On Mar 11, 11:44 pm, Luke kickingje...@gmail.com wrote: