find
throws an ActiveRecord::RecordNotFound
error if it could not find a Country
with that ID in the database.
You should check a few things:
- Is
params[:country_id]
nil? - In a terminal, run
rake routes
, find your route and check if there's indeed a:country_id
parameter in it. Also see the routing documentation. - If
params[:country_id]
is not nil, there might not be such a country in your database.
See the Rails documentation for more information.