changed model::scalar to take field and conditions rather than sql