Hi team, I doing one rails application , i have doubt i can create user form and upload images , i did create user(using session ) and create tmp folder and save the database my issue is my error is: undefindedmeth''[]'' error came that place: *name= Upload[''imagepath''].original_filename* please slove the problem my code : ********************************************** @login=Upload.new(params[:userform]) session[:user] = Upload.new(params[:userform]) @sn= session[:user].name @pn= session[:user].email @ss=FileUtils.mkdir_p("tmp/session/#{@sn}") name= Upload[''imagepath''].original_filename directory="tmp/session/#{@sn}" path=File.join(directory,name) @str=directory+"/"+name File.open(path,"wb"){|f|f.write(upload[''imagepath''].read)} @upload=Upload.new #@upload=ImagePath.save(params[:upload]) @upload[''name'']=@sn @upload[''email'']=@pn @upload[''userpath'']=@ss #@upload[''imagepath'']=@str #@upload=DataFile.save(params[:upload]) @upload.save puts "****************" puts @sn puts @ss #puts @str end def uploadfile -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
You''re trying to call [''imagepath''] on your Upload class. I''m not entirely sure what you''re trying to do with that line of code? Maybe you meant to do something like this and call it on the instance of the Upload class? session[:user].imagepath Have you thought about using something like "will_paginate" to handle your file uploads? It would probably make your life a lot easier. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/daBxkgqylfcJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I meant to say "paperclip" instead of "will_paginate". That''s what I get for reading more than one thread at once :) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/NESofzPtsXwJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.