lib/ninja_model/relation/finder_methods.rb in ninja-model-0.7.1 vs lib/ninja_model/relation/finder_methods.rb in ninja-model-0.7.2

- old
+ new

@@ -54,10 +54,14 @@ end def find_one(id) id = id.id if NinjaModel::Base === id - where(primary_key.to_sym => id).first + record = where(primary_key.to_sym => id).first + unless record + raise RecordNotFound, "Couldn't find #{@klass.name} with #{primary_key}=#{id}" + end + record end def find_first if loaded? @records.first