-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refs #20: Add save paper input to db
- Loading branch information
1 parent
5cb7f0f
commit ce102e3
Showing
4 changed files
with
49 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,23 @@ | ||
class PapersController < ApplicationController | ||
def new | ||
#@paper = Paper.new() | ||
@paper = Paper.new | ||
end | ||
|
||
def create | ||
@paper = Paper.new(paper_params) | ||
if @paper.save | ||
redirect_to @paper | ||
else | ||
render 'new' | ||
end | ||
end | ||
|
||
def show | ||
@paper = Paper.find(params[:id]) | ||
end | ||
|
||
private | ||
def paper_params | ||
params.require(:paper).permit(:title, :venue, :year) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<p> | ||
<strong>Title:</strong> | ||
<%= @paper.title %> | ||
</p> | ||
|
||
<p> | ||
<strong>Venue:</strong> | ||
<%= @paper.venue %> | ||
</p> | ||
|
||
<p> | ||
<strong>Year:</strong> | ||
<%= @paper.year %> | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters