Hello! I''m using Rails 3, Uploadify, to send images to S3.
Right now all the images being uploaded to S3 have the MIME:
application/octet-stream
I''d like to fix that but I''m getting the following error:
NoMethodError (undefined method `original_filename'' for
#<ActiveSupport::HashWithIndifferentAccess:0x107c81998>):
app/models/photo.rb:29:in `upload_file=''
app/controllers/photos_controller.rb:15:in `upload''
app/middleware/flash_session_cookie_middleware.rb:14:in `call''
I think this is because all the tutorials out there aren''t Rails 3
friendly. Anyone have any ideas? Here''s the code:
# Controller
def create
@photo = @photoalbum.photos.build(:upload_file => params[:photo])
...
end
# Model
class Photo < ActiveRecord::Base
require ''mime/types''
...
def upload_file=(data)
data.content_type MIME::Types.type_for(data.original_filename).to_s
self.image = data
end
end
--
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.