Hi all,
In "New Video" page user enter the new video details and click
"Upload"
button the system is displaying error page with Safari Browser on
Windows machine.
Code :   - fold - unfold
   1. NoMethodError in ResourcesController #create_video
   2.
[�>U܀\002� \022��
��S�:X\200� �
�Y\ti\237Zv&P\037\235eY\224\211\214\246\177�kT)h\rҰb
\202�on\025!a\r�"���\r\201��@/��x\tP��J\210܏\025C�\(A\a\024����\204���Ŝ\aH\a\376\271\225�A�\232\204<ߚ\020\211B��;1@�...................so
on
   3. code:
   4. controller =>
   5. def create_video
   6.       params[:tag][:name] comma_seperated_tags(params[:tag][:name])
   7.       @video = Video.create_video(params[:video],
params[:thumbnail], params[:title], params[:tag][:name],
params[:category])
   8.       if @video
   9.         flash[:success_notice] = "Video uploaded successfully."
  10.       else
  11.         flash[:success_notice] = "Video uploading failed"
  12.       end
  13.       @categories = Category.find(:all)
  14.       render :action => :videos
  15.   end
  16.
  17. Model =>
  18.   def self.create_video(vid,thumbnail,title,tag, category)
  19.     if valid_video?(vid) && valid_thumbnail?(thumbnail)
  20.       video_filename = sanitize_attachment_name(vid)
  21.       thumbnail_filename = sanitize_attachment_name(thumbnail)
  22.       @video = self.new do |video|
  23.         video.title = title
  24.         video.video_name = video_filename
  25.         video.thumbnail_name = thumbnail_filename
  26.         video.category_id = category
  27.         video.tag_list = tag
  28.       end
  29.       self.upload_video(vid, video_filename, @video.id) &&
self.upload_thumbnail(thumbnail, thumbnail_filename, @video.id) if
@video.save
  30.     end
  31.      rescue
  32.       false
  33.   end
  34.
  35.   def self.valid_video?(attachment)
  36.     if attachment.kind_of? StringIO or attachment.kind_of?
Tempfile
  37.       true
  38.     else
  39.       false
  40.     end
  41.   end
  42.
  43.   def self.valid_thumbnail?(attachment)
  44.     if attachment.kind_of? StringIO or attachment.kind_of?
Tempfile
  45.       true
  46.     else
  47.       false
  48.     end
  49.   end
  50.
  51.   def self.sanitize_attachment_name(attachment)
  52.     File.basename(attachment.original_filename)
  53.   end
  54.
  55.   def self.upload_video(video, video_name, video_id)
  56.     video_path = VIDEO_UPLOAD_PATH + "#{video_id}_" + video_name
  57.     File.open(video_path, "wb") { |f| f.write(video.read) }
  58.   end
  59.
  60.   def self.upload_thumbnail(thumbnail, thumbnail_name, video_id)
  61.     thumbnail_path = THUMBNAIL_UPLOAD_PATH + "#{video_id}_" +
thumbnail_name
  62.     File.open(thumbnail_path, "wb") { |f|
f.write(thumbnail.read)
}
  63.   end
.........
The error was raising only with safari and works good with FF and IE
did any one have any idea with this issue
help me !!
-- 
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---