Class: Dorsale::Alexandrie::AttachmentsController
- Inherits:
-
Dorsale::ApplicationController
- Object
- ApplicationController
- Dorsale::ApplicationController
- Dorsale::Alexandrie::AttachmentsController
- Defined in:
- app/controllers/dorsale/alexandrie/attachments_controller.rb
Instance Method Summary collapse
Methods inherited from Dorsale::ApplicationController
Instance Method Details
#create ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/dorsale/alexandrie/attachments_controller.rb', line 21 def create @attachment = scope.new() @attachment, :create? if @attachment.save notify_attachable # flash[:notice] = t("messages.attachments.create_ok") else flash[:alert] = t("messages.attachments.create_error") end render_or_redirect end |
#destroy ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'app/controllers/dorsale/alexandrie/attachments_controller.rb', line 57 def destroy @attachment, :delete? if @attachment.destroy notify_attachable # flash[:notice] = t("messages.attachments.delete_ok") else flash[:alert] = t("messages.attachments.delete_error") end render_or_redirect end |
#edit ⇒ Object
36 37 38 39 40 41 42 |
# File 'app/controllers/dorsale/alexandrie/attachments_controller.rb', line 36 def edit @attachment, :update? @attachable = @attachment.attachable render :index end |
#index ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'app/controllers/dorsale/alexandrie/attachments_controller.rb', line 12 def index @attachable = find_attachable skip_policy_scope @attachable, :read? @attachment = scope.new() end |
#update ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/controllers/dorsale/alexandrie/attachments_controller.rb', line 44 def update @attachment, :update? if @attachment.update() notify_attachable # flash[:notice] = t("messages.attachments.update_ok") else flash[:alert] = t("messages.attachments.update_error") end render_or_redirect end |