Return empty on query RoR
I am doing a query for some data, if the query is empty or returns no data because there is none. How do I show that the query was empty?
Here I am finding Todo’s via params[:id]
@todo = Todo.find(params[:id])
Now if this comes back with some data it will list out what is in the database. But if it returns nothing how do I show this?
if @todo == nil
@todo = "Sorry No Todo's!"
end
I have tried an if statement (above) but it does not work... How do I show the following text? “Sorry No Todo’s” if there is nothing in the database?
