Fix AR undefined method `first' for nil if resource unavailable