Guys, Here is a option.
In My Decorator I have this code.
def president_name
self.object.leader.try(:username)
end
In My Model .
def leader
groups.order(level: :desc).limit(1).first.try(:leader)
end
So , In the scenario as above how would I limit the contagiousness of nil and How would I handle the nil. I do not want to check for nil every step of the way or have to use try as I am doing in above example. Please suggest the best solution to improve the code above.