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 |
# File 'app/controllers/dorsale/alexandrie/attachments_controller.rb', line 21 def create @attachment = scope.new() @attachment, :create? if @attachment.save # flash[:notice] = t("messages.attachments.create_ok") else flash[:alert] = t("messages.attachments.create_error") end render_or_redirect end |
#destroy ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 |
# File 'app/controllers/dorsale/alexandrie/attachments_controller.rb', line 55 def destroy @attachment, :delete? if @attachment.destroy # flash[:notice] = t("messages.attachments.delete_ok") else flash[:alert] = t("messages.attachments.delete_error") end render_or_redirect end |
#edit ⇒ Object
35 36 37 38 39 40 41 |
# File 'app/controllers/dorsale/alexandrie/attachments_controller.rb', line 35 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
43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/controllers/dorsale/alexandrie/attachments_controller.rb', line 43 def update @attachment, :update? if @attachment.update() # flash[:notice] = t("messages.attachments.update_ok") else flash[:alert] = t("messages.attachments.update_error") end render_or_redirect end |