Rails 3 -NoMethodError (undefined method `original_filename

Hello! I’m using Rails 3, Uploadify, to send images to S3.

Right now all the images being uploaded to S3 have the MIME:

I’d like to fix that but I’m getting the following error:

NoMethodError (undefined method `original_filename' for

app/models/photo.rb:29:in upload_file=' app/controllers/photos_controller.rb:15:inupload’
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])

# Model

class Photo < ActiveRecord::Base
  require 'mime/types'
  def upload_file=(data)
    data.content_type =

self.image = data

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs