diff --git a/app/controllers/metapurses_controller.rb b/app/controllers/metapurses_controller.rb index 9a52881d..0e52d524 100644 --- a/app/controllers/metapurses_controller.rb +++ b/app/controllers/metapurses_controller.rb @@ -52,6 +52,7 @@ class MetapursesController < ApplicationController # DELETE /metapurses/1 or /metapurses/1.json def destroy + authorize @metapurse @metapurse.destroy! respond_to do |format| diff --git a/app/views/metapurses/index.html.haml b/app/views/metapurses/index.html.haml index deeec458..0d7c8c41 100644 --- a/app/views/metapurses/index.html.haml +++ b/app/views/metapurses/index.html.haml @@ -4,19 +4,21 @@ %thead %tr %th Name - %th Data - %th - %th - %th + -# %th Data + - if policy(Metapurse).new? + -# %th + %th + %th %tbody - @metapurses.each do |metapurse| %tr - %td= metapurse.name - %td= metapurse.data - %td= link_to 'Show', metapurse - %td= link_to 'Edit', edit_metapurse_path(metapurse) - %td= link_to 'Destroy', metapurse, method: :delete, data: { confirm: 'Are you sure?' } + %td= link_to metapurse.name, metapurse + -# %td= metapurse.data + - if policy(metapurse).update? + -# %td= link_to 'Show', metapurse + %td= link_to 'Edit', edit_metapurse_path(metapurse) + %td= link_to 'Destroy', metapurse, method: :delete, data: { confirm: 'Are you sure?' } %br diff --git a/app/views/metapurses/show.html.haml b/app/views/metapurses/show.html.haml index c649a9d5..8a076292 100644 --- a/app/views/metapurses/show.html.haml +++ b/app/views/metapurses/show.html.haml @@ -32,6 +32,7 @@ $#{number_with_delimiter(total_value.round(2))} USD -= link_to 'Edit', edit_metapurse_path(@metapurse) -\| +- if policy(@metapurse).edit? + = link_to 'Edit', edit_metapurse_path(@metapurse) + \| = link_to 'Back', metapurses_path