Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Note < ActiveRecord::Base
- def file= file
- if file.present?
- # do something with the file
- if /image/.match(file.content_type)
- type = "Image"
- elsif /video/.match(file.content_type)
- type = "Video"
- else
- type = "Other"
- end
- self.save
- asset = self.assets.create do |a|
- a.type = type
- a.file = file
- end
- if type == "Video"
- asset.encode
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment