Skip to content

Commit

Permalink
Add update function to paper controller. Closes #37
Browse files Browse the repository at this point in the history
  • Loading branch information
manner committed Nov 8, 2017
1 parent 4be4d59 commit 984b3c7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/controllers/papers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ def create
end
end

def update
@paper = Paper.find(params[:id])
if @paper.update(paper_params)
redirect_to @paper
else
render 'edit'
end
end

private
def paper_params
params.require(:paper).permit(:title, :venue, :year)
Expand Down
5 changes: 5 additions & 0 deletions app/views/papers/edit.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<h1>Edit Paper</h1>

<%= render 'form' %>

<%= link_to 'Back', papers_path %>

0 comments on commit 984b3c7

Please sign in to comment.