app/models/category.rb
# This parallels last_activity column in Topic model.
This parallels last_activity column in Topic model.
This parallels last_activity column in Topic model .
def last_activity
    if topics.empty?
      updated_at
    else
      topics.first.last_activity
    end
  end
def last_activity if topics . empty? updated_at else topics . first . last_activity end end
This parallels last_activity column in Topic model.
This parallels last_activity column in Topic model .
# If there are no topics yet in thic category then: # Otherwise last activity is newest topic in this category is returned.