for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
class Category < ActiveRecord::Base
has_many :categorizations
has_many :sessions, :through => :categorizations
def self.find_or_create_defaults
cnf = YAML.load_file(File.join(Rails.root, 'config', 'categories.yml'))
cnf.each do |key, val|
Category.where(id: key).first_or_initialize.update(name: val)
end
def i18n_key
name.gsub(/&/, '').gsub(/\s+/, '_').downcase