personal-book/app/controllers/admin/book_author_types_controlle...

44 lines
1.1 KiB
Ruby
Raw Normal View History

2014-07-31 13:51:25 +00:00
class Admin::BookAuthorTypesController < OrbitMemberController
2015-01-09 07:38:49 +00:00
before_action :allow_admin_only
def new
2015-01-09 07:38:49 +00:00
@author_type = BookAuthorType.new
@url = admin_book_author_types_path(@author_type)
render :layout=>false
end
def create
2015-01-09 07:38:49 +00:00
@author_type = BookAuthorType.new(author_type_params)
@author_type.save
@author_types = BookAuthorType.all
render :partial=>'list', :layout=>false
end
2015-01-09 07:38:49 +00:00
def edit
@author_type = BookAuthorType.find(params[:id])
@url = admin_book_author_type_path(@author_type)
render :layout=>false
end
def update
2015-01-09 07:38:49 +00:00
@author_type = BookAuthorType.find(params[:id])
@author_type.update_attributes(author_type_params)
@author_type.save
@author_types = BookAuthorType.all
render :partial=>'list', :layout=>false
end
def destroy
2015-01-09 07:38:49 +00:00
author_type = BookAuthorType.find(params[:id])
author_type.destroy
@author_types = BookAuthorType.all
render :partial=>'list', :layout=>false
end
private
2015-01-09 07:38:49 +00:00
def author_type_params
params.require(:book_author_type).permit! rescue nil
end
end