Andrew Filipowski
2005-Dec-13 15:41 UTC
File-column 0.3.1 and different errors depending on the browser used
Ok starting to loose my mind here. And since I am still learing rails and ruby this is fast approaching the limit of my knowledge. I took a stab out of frustration and opened up firefox to see if I was going crazy or not and I got a new error. I am running rails on a mac using the locomotive .14.3 max bundle. When I try to upload a file using safari (Version 2.0.2 (416.13)) i noticed the following was in the parameters dump when I tried to send a file. Parameters: {"commit"=>"Update", "multipart"=>"true", "id"=>"296", "entry"=>{"image_temp"=>""}} this finally jumped out at me. Where the heck is my image? I selected one I know that for sure why is it not in the params list. The crazier thing is that a temp directory is getting created where file- column says it should however the directory is empty. I received the following error: undefined method `original_filename'' for {"image_temp"=>""}:HashWithIndifferentAccess After pulling my hair out I opened up firefox went to the page where I upload a file. This time my error page looks like this: undefined method `original_filename'' for {"image_temp"=>"", "image"=>"5391.jpg"}:HashWithIndifferentAccess and the parameters dump: Parameters: {"commit"=>"Update", "multipart"=>"true", "id"=>"298", "entry"=>{"image_temp"=>"", "image"=>"5391.jpg"}} This shows promise at least the image is showing up in the params list. it seems either rails, or locomotive or file-column does not like safari as the entry[image] is not getting passed to the controller while firefox (1.0.7 as well as firefox 1.5) is at least adding the image to my params list but is not liked all that much either. After digging around in the file_column.rb file that there are some special cases for IE but on further review they seem to only swap around slashes. This made me curious. I located a windows box in the office and tried to upload a file. I did receive the same error on firefox as I did with the mac version however on IE I received the following: undefined method `original_filename'' for #<HashWithIndifferentAccess: 0x22573b4> with a params list of Parameters: {"commit"=>"Update", "multipart"=>"true", "id"=>"301", "entry"=>{"image_temp"=>"", "image"=>"C:\\Documents and Settings\ \ryarrow\\Desktop\\image.jpg"}} now I am new to rails so I took a look at what was special for IE and it looks to me (correct me if I am wrong) that this code filename = File.basename(filename.gsub("\\", "/")) # work-around for IE is supposed to take those \\ slashes and change them to a single / On to the logs. it seems no matter what browser I use I am getting the same stack trace issue in file_column /vendor/plugins/file_column/lib/file_column.rb:187:in `store_upload'' /vendor/plugins/file_column/lib/file_column.rb:118:in `upload'' /vendor/plugins/file_column/lib/file_column.rb:54:in `assign'' /vendor/plugins/file_column/lib/file_column.rb:584:in `image='' /vendor/plugins/file_column/lib/file_column.rb:583:in `image='' so I am at least seeing the plugin and trying to give it data. But I can''t tell from the logs where it is falling apart on me. Any thoughts? Andrew _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Andrew Filipowski
2005-Dec-13 16:56 UTC
Re: File-column 0.3.1 and different errors depending on the browser used
Ok well I noticed the other file_column question and so I made a change to my form_tag as I did not know you need the brackets around the action however now in firefox I get a similar error while in safari I just get a hang and than a lost connection error. I feel like I am getting close but not sure. Andrew On Dec 13, 2005, at 10:41 AM, Andrew Filipowski wrote:> Ok starting to loose my mind here. And since I am still learing > rails and ruby this is fast approaching the limit of my knowledge. > I took a stab out of frustration and opened up firefox to see if I > was going crazy or not and I got a new error. I am running rails on > a mac using the locomotive .14.3 max bundle. When I try to upload a > file using safari (Version 2.0.2 (416.13)) i noticed the following > was in the parameters dump when I tried to send a file. > > Parameters: {"commit"=>"Update", "multipart"=>"true", "id"=>"296", > "entry"=>{"image_temp"=>""}} > > this finally jumped out at me. Where the heck is my image? I > selected one I know that for sure why is it not in the params list. > The crazier thing is that a temp directory is getting created where > file-column says it should however the directory is empty. > > I received the following error: > > undefined method `original_filename'' for > {"image_temp"=>""}:HashWithIndifferentAccess > > After pulling my hair out I opened up firefox went to the page > where I upload a file. This time my error page looks like this: > > undefined method `original_filename'' for {"image_temp"=>"", > "image"=>"5391.jpg"}:HashWithIndifferentAccess > > and the parameters dump: > > Parameters: {"commit"=>"Update", "multipart"=>"true", "id"=>"298", > "entry"=>{"image_temp"=>"", "image"=>"5391.jpg"}} > > This shows promise at least the image is showing up in the params > list. it seems either rails, or locomotive or file-column does not > like safari as the entry[image] is not getting passed to the > controller while firefox (1.0.7 as well as firefox 1.5) is at least > adding the image to my params list but is not liked all that much > either. > > After digging around in the file_column.rb file that there are some > special cases for IE but on further review they seem to only swap > around slashes. This made me curious. I located a windows box in > the office and tried to upload a file. I did receive the same error > on firefox as I did with the mac version however on IE I received > the following: > > undefined method `original_filename'' for > #<HashWithIndifferentAccess:0x22573b4> > > with a params list of > > Parameters: {"commit"=>"Update", "multipart"=>"true", "id"=>"301", > "entry"=>{"image_temp"=>"", "image"=>"C:\\Documents and Settings\ > \ryarrow\\Desktop\\image.jpg"}} > > now I am new to rails so I took a look at what was special for IE > and it looks to me (correct me if I am wrong) that this code > > filename = File.basename(filename.gsub("\\", "/")) # work-around > for IE > > is supposed to take those \\ slashes and change them to a single / > > On to the logs. > > it seems no matter what browser I use I am getting the same stack > trace issue in file_column > > /vendor/plugins/file_column/lib/file_column.rb:187:in `store_upload'' > /vendor/plugins/file_column/lib/file_column.rb:118:in `upload'' > /vendor/plugins/file_column/lib/file_column.rb:54:in `assign'' > /vendor/plugins/file_column/lib/file_column.rb:584:in `image='' > /vendor/plugins/file_column/lib/file_column.rb:583:in `image='' > > so I am at least seeing the plugin and trying to give it data. But > I can''t tell from the logs where it is falling apart on me. > > Any thoughts? > > Andrew > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Andrew Filipowski
2005-Dec-13 17:16 UTC
Re: File-column 0.3.1 and different errors depending on the browser used
Well That was weird. I figured out my issue and so going to put it here for others as well. I found that I had use a start_form_tag instead of form_tag in my view. I also could not have a hidden_field_tag I needed to have hidden_field only in the view. Lastly in the controller I had to define add the following to my update action: @entry.update_attributes(:image => params[:entry][:image], :response_label => "Nothing", :required => "0") so my view now looks like this: %= start_form_tag({:action => ''update_image''}, :multipart => true) %> Your Text:<br/> <%= file_column_field ''entry'', ''image'' %> <br/> <%= hidden_field(''entry'', ''id'') %> <div id="profile_button" > <%= submit_tag("Update") %> instead of: <%= form_tag({:action => ''update_image''}, :multipart => true) %> Your Text:<br/> <%= file_column_field ''entry'', ''image'' %> <br/> <%= hidden_field_tag(:id, @entry.id) %> <div id="profile_button" > <%= submit_tag("Update") %> As I said I am new to ruby and rails so not entirely sure why this is the case but it works now. Andrew On Dec 13, 2005, at 11:56 AM, Andrew Filipowski wrote:> Ok well I noticed the other file_column question and so I made a > change to my form_tag as I did not know you need the brackets > around the action however now in firefox I get a similar error > while in safari I just get a hang and than a lost connection error. > > I feel like I am getting close but not sure. > > Andrew > > > On Dec 13, 2005, at 10:41 AM, Andrew Filipowski wrote: > >> Ok starting to loose my mind here. And since I am still learing >> rails and ruby this is fast approaching the limit of my knowledge. >> I took a stab out of frustration and opened up firefox to see if I >> was going crazy or not and I got a new error. I am running rails >> on a mac using the locomotive .14.3 max bundle. When I try to >> upload a file using safari (Version 2.0.2 (416.13)) i noticed the >> following was in the parameters dump when I tried to send a file. >> >> Parameters: {"commit"=>"Update", "multipart"=>"true", "id"=>"296", >> "entry"=>{"image_temp"=>""}} >> >> this finally jumped out at me. Where the heck is my image? I >> selected one I know that for sure why is it not in the params >> list. The crazier thing is that a temp directory is getting >> created where file-column says it should however the directory is >> empty. >> >> I received the following error: >> >> undefined method `original_filename'' for >> {"image_temp"=>""}:HashWithIndifferentAccess >> >> After pulling my hair out I opened up firefox went to the page >> where I upload a file. This time my error page looks like this: >> >> undefined method `original_filename'' for {"image_temp"=>"", >> "image"=>"5391.jpg"}:HashWithIndifferentAccess >> >> and the parameters dump: >> >> Parameters: {"commit"=>"Update", "multipart"=>"true", "id"=>"298", >> "entry"=>{"image_temp"=>"", "image"=>"5391.jpg"}} >> >> This shows promise at least the image is showing up in the params >> list. it seems either rails, or locomotive or file-column does not >> like safari as the entry[image] is not getting passed to the >> controller while firefox (1.0.7 as well as firefox 1.5) is at >> least adding the image to my params list but is not liked all that >> much either. >> >> After digging around in the file_column.rb file that there are >> some special cases for IE but on further review they seem to only >> swap around slashes. This made me curious. I located a windows box >> in the office and tried to upload a file. I did receive the same >> error on firefox as I did with the mac version however on IE I >> received the following: >> >> undefined method `original_filename'' for >> #<HashWithIndifferentAccess:0x22573b4> >> >> with a params list of >> >> Parameters: {"commit"=>"Update", "multipart"=>"true", "id"=>"301", >> "entry"=>{"image_temp"=>"", "image"=>"C:\\Documents and Settings\ >> \ryarrow\\Desktop\\image.jpg"}} >> >> now I am new to rails so I took a look at what was special for IE >> and it looks to me (correct me if I am wrong) that this code >> >> filename = File.basename(filename.gsub("\\", "/")) # work-around >> for IE >> >> is supposed to take those \\ slashes and change them to a single / >> >> On to the logs. >> >> it seems no matter what browser I use I am getting the same stack >> trace issue in file_column >> >> /vendor/plugins/file_column/lib/file_column.rb:187:in `store_upload'' >> /vendor/plugins/file_column/lib/file_column.rb:118:in `upload'' >> /vendor/plugins/file_column/lib/file_column.rb:54:in `assign'' >> /vendor/plugins/file_column/lib/file_column.rb:584:in `image='' >> /vendor/plugins/file_column/lib/file_column.rb:583:in `image='' >> >> so I am at least seeing the plugin and trying to give it data. But >> I can''t tell from the logs where it is falling apart on me. >> >> Any thoughts? >> >> Andrew >> >> >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails