diff --git a/app/controllers/admin/books_controller.rb b/app/controllers/admin/books_controller.rb index d20ff46..ae43e4d 100644 --- a/app/controllers/admin/books_controller.rb +++ b/app/controllers/admin/books_controller.rb @@ -2,7 +2,8 @@ class Admin::BooksController < OrbitMemberController include Admin::BooksHelper layout "member_plugin" - before_action :set_book, only: [:show, :edit , :update, :destroy] + before_action :set_book, only: [:show, :edit , :update] + before_action :find_book, only: [:destroy] before_action :get_plugins, only: [:index, :book_setting, :new, :create, :edit, :update] before_action :set_types, only: [:index,:book_setting, :new, :edit, :create, :update] before_action :set_plugin @@ -156,6 +157,10 @@ class Admin::BooksController < OrbitMemberController @book = Book.find_by(uid: uid) end + def find_book + @book = Book.find_by(id: params[:id]) + end + def book_attributes params.require(:book).permit! rescue nil end @@ -172,4 +177,4 @@ class Admin::BooksController < OrbitMemberController @author_types = BookAuthorType.all @book_types = BookType.all end -end +end \ No newline at end of file