desktop fix book cant delete

This commit is contained in:
JiangRu 2014-12-10 10:41:44 +08:00
parent 198a9f503a
commit 3f56689240
1 changed files with 7 additions and 2 deletions

View File

@ -2,7 +2,8 @@ class Admin::BooksController < OrbitMemberController
include Admin::BooksHelper include Admin::BooksHelper
layout "member_plugin" 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 :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_types, only: [:index,:book_setting, :new, :edit, :create, :update]
before_action :set_plugin before_action :set_plugin
@ -156,6 +157,10 @@ class Admin::BooksController < OrbitMemberController
@book = Book.find_by(uid: uid) @book = Book.find_by(uid: uid)
end end
def find_book
@book = Book.find_by(id: params[:id])
end
def book_attributes def book_attributes
params.require(:book).permit! rescue nil params.require(:book).permit! rescue nil
end end
@ -172,4 +177,4 @@ class Admin::BooksController < OrbitMemberController
@author_types = BookAuthorType.all @author_types = BookAuthorType.all
@book_types = BookType.all @book_types = BookType.all
end end
end end