Skip to content

Commit 038dafe

Browse files
authored
Merge pull request #669 from PecanProject/fix_issue_668
Fix citation controller's show method
2 parents ad16618 + e55b2cb commit 038dafe

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

app/controllers/citations_controller.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ def index
123123
# GET /citations/1
124124
# GET /citations/1.xml
125125
def show
126-
@citation = Citation.where(:id => params[:id]).includes(params[:include]).first
126+
# find_by! throws an ActiveRecord::RecordNotFound exception if no citation
127+
# with the given id exists so that we don't attempt to display a nil
128+
# citation.
129+
@citation = Citation.includes(params[:include]).find_by!(:id => params[:id])
127130

128131
respond_to do |format|
129132
format.html # show.html.erb

0 commit comments

Comments
 (0)