edit authors, delete users, UI changes
This commit is contained in:
parent
e36cc36947
commit
ccb6e23960
19 changed files with 190 additions and 75 deletions
|
@ -1,5 +1,28 @@
|
|||
class AuthorsController < ApplicationController
|
||||
before_action :ensure_admin
|
||||
before_action :set_author, only: [:edit, :update]
|
||||
|
||||
def index
|
||||
@authors = Author.all
|
||||
end
|
||||
|
||||
def edit
|
||||
@author = Author.find(params[:id])
|
||||
end
|
||||
|
||||
def update
|
||||
if @author.update(author_params)
|
||||
redirect_to '/authors'
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_author
|
||||
@author = Author.find(params[:id])
|
||||
end
|
||||
|
||||
def author_params
|
||||
params.require(:author).permit(:first_name, :last_name)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue