Good morning folks. In a model of mine, I created a method for displaying a row. The page wasn't working cause next and reify methods we're undefined , so I put a try on them. But the page doesn't load and is displaying this error on browser. "504 Gateway Time-out"
v = self.versions.first
if v.present?
while v.try(:reify).try(:reason).try(:name).blank? do
v = v.try(:next)
end
v.reify.try(:reason).try(:name)
end
What do you recommend me to make this code much cleaner and to prevent it for long page loading again ?