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
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/dorsale/alexandrie/attachments_controller.rb', line 18 def create @attachment = ::Dorsale::Alexandrie::Attachment.new() :create, @attachment 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
48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/controllers/dorsale/alexandrie/attachments_controller.rb', line 48 def destroy :delete, @attachment 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
32 33 34 |
# File 'app/controllers/dorsale/alexandrie/attachments_controller.rb', line 32 def edit :update, @attachment end |
#index ⇒ Object
12 13 14 15 16 |
# File 'app/controllers/dorsale/alexandrie/attachments_controller.rb', line 12 def index @attachable = find_attachable :read, @attachable end |
#update ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/dorsale/alexandrie/attachments_controller.rb', line 36 def update :update, @attachment if @attachment.update_attributes() flash[:notice] = t("messages.attachments.update_ok") else flash[:alert] = t("messages.attachments.update_error") end render_or_redirect end |