validates:username,presence:true,format:{with:/\A[a-z0-9_]+\z/i,message:'only letters, numbers and underscores'},uniqueness:{scope::domain,case_sensitive:false},if:'local?'
validates:username,presence:true,format:{with:/\A[a-z0-9_]+\z/i,message:'only letters, numbers and underscores'},uniqueness:{scope::domain,case_sensitive:false},length:{maximum:30},if:'local?'
scope:with_counters,->{select('statuses.*, (select count(r.id) from statuses as r where r.reblog_of_id = statuses.id) as reblogs_count, (select count(f.id) from favourites as f where f.status_id = statuses.id) as favourites_count')}