class Medium < AbstractResource belongs_to :imageable, polymorphic: true belongs_to :account mount_uploader :medium, MediumUploader crop_uploaded :medium # # # attr_accessible :upload # # has_attached_file :upload # # include Rails.application.routes.url_helpers def to_jq_upload { "name" => self.medium.filename, "size" => self.medium.size, "url" => self.medium.url, "thumbnailUrl" => self.medium.url, "deleteUrl" => media_url(self, host: 'localhost:3000').gsub( '.','/'), "deleteType" => "DELETE" # "error": "Filetype not allowed" } end end