We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents ad16618 + e55b2cb commit 038dafeCopy full SHA for 038dafe
1 file changed
app/controllers/citations_controller.rb
@@ -123,7 +123,10 @@ def index
123
# GET /citations/1
124
# GET /citations/1.xml
125
def show
126
- @citation = Citation.where(:id => params[:id]).includes(params[:include]).first
+ # 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])
130
131
respond_to do |format|
132
format.html # show.html.erb
0 commit comments