This may be appendix 2.3, but you can simply use the exclamation point after a dynamic search as follows:
def show
@project = Project.find_by_permalink!(params[:id])
end
If nothing is found, an exception is thrown ActiveRecord::RecordNotFound.
source
share