themen ueberarbeitet attachments verwalten

This commit is contained in:
2014-06-09 23:14:05 +05:30
parent babbfb7d73
commit 6451c0f175
22 changed files with 245 additions and 38 deletions

View File

@@ -12,9 +12,22 @@
class Attachment < ActiveRecord::Base
has_paper_trail
attr_accessible :name, :datei
attr_accessible :name, :datei, :datei_cache
belongs_to :thema
mount_uploader :datei, AttachmentUploader
validates :thema, :presence => true
validates :name, :presence => true
def to_jq_upload
{
"id" => read_attribute(:id),
"title" => read_attribute(:title),
"description" => read_attribute(:desc),
"name" => read_attribute(:title),
"size" => datei.size,
"url" => datei.url,
"thumbnail_url" => datei.thumb.url,
"delete_type" => "DELETE"
}
end
end