remove attachments

This commit is contained in:
Stella Rouzi 2014-08-17 16:32:01 +03:00
parent 6579b3220f
commit 30c2d66a15
6 changed files with 1 additions and 286 deletions

View file

@ -140,10 +140,5 @@ class Ability
can :manage, Commercial, commercialable_type: 'Event', commercialable_id: user.events.pluck(:id)
# View commercials of confirmed events
can :show, Commercial, commercialable_type: 'Event', commercialable_id: Event.where(state: 'confirmed').pluck(:id)
can :manage, EventAttachment do |ea|
Event.find(ea.event_id).event_users.where(user_id: user.id).present?
end
can :create, EventAttachment
end
end

View file

@ -1,26 +0,0 @@
class EventAttachment < ActiveRecord::Base
has_paper_trail
belongs_to :event
attr_accessible :public, :attachment, :event_id, :title
has_attached_file :attachment, path: ":rails_root/storage/:rails_env/attachments/:id/:style/:basename.:extension"
include Rails.application.routes.url_helpers
def to_jq_upload
{
"name" => read_attribute(:attachment_file_name),
"size" => read_attribute(:attachment_file_size),
"title" => read_attribute(:title),
"public" => read_attribute(:public),
#"url" => attachment.url(:original),
"url" => conference_proposal_event_attachment_path(self.event.conference.short_title, self.event_id, self.id),
"delete_url" => conference_proposal_event_attachment_path(self.event.conference.short_title, self.event_id, self.id),
"delete_type" => "DELETE"
}
end
#:path => ":rails_root/public/system/:attachment/:id/:style/:filename",
# :url => "/system/:attachment/:id/:style/:filename"
#has_paper_trail :meta => {:associated_id => :event_id, :associated_type => "Event"}
end