zachinglis/crummy

View on GitHub
example/app/models/post.rb

Summary

Maintainability
A
0 mins
Test Coverage
class Post < ActiveRecord::Base
  belongs_to :category
  
  def categories
    category    = self.category
    categories  = []
    
    while category.present?
      categories << category
      category = category.category
    end
    
    categories.reverse
  end
  
  def to_s
    title
  end
end