I have a system where uploads are stored in a database with a filename based on the MD5 hash of the file contents. Following the logic of this, I assigned upload_file_name to be a unique index in my migration.
What I want to do is, whenever a user tries to upload a file whose md5 hash already exists in the database, just redirect to that other record rather than making a copy (which actually just throw an error because upload_file_name is a unique index) So I put in my model: self = other_upload if other_upload = Upload.find_by_upload_file_name(self[:upload_file_name]) which ActiveRecord doesn't let me do saying "Can't change the value of self" Ideas? -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

