module Guff class SiteModel < Model SQL = TemplateCache.new({ get_default: " SELECT site_id FROM sites WHERE is_default LIMIT 1 ", }) def initialize(models : Models) super(models, SQL) end def get_default : Int r = one(:get_default, nil, {} of String => String) raise "no default site" unless r r.to_i end def to_site(host : String?) : Int # TODO get_default end end end