title: Why the default rule does not work in Yii2?
body: <p>I created a model with the following content:</p>
  <pre><code>class User extends \yii\db\ActiveRecord implements IdentityInterface
  {
      const STATUS_DELETED = 0;
      const STATUS_ACTIVE = 10;
  
      public static function tableName()
      {
          return 'user';
      }
  
  
      public function rules()
      {
          return [
              [['username', 'auth_key', 'password', 'status', 'created_at', 'updated_at'], 'required'],
              [['status', 'created_at', 'updated_at'], 'integer'],
              [['username', 'fullname', 'password', 'password_reset_token', 'email'], 'string', 'max' =&gt; 255],
              [['auth_key'], 'string', 'max' =&gt; 32],
              [['username'], 'unique'],
  
              ['status', 'default', 'value' =&gt; self::STATUS_ACTIVE],
              ['created_at', 'default', 'value' =&gt; 123],
              ['status', 'in', 'range' =&gt; [self::STATUS_ACTIVE, self::STATUS_DELETED]],
              ['status', 'filter', 'filter' =&gt; 'intval'],
          ];
      }
  
      //... some functions below
  }
  </code></pre>
  <p>Now in the controller I do this:</p>
  <pre><code>$user = new User();
  $user-&gt;username = 'admin';
  $user-&gt;email = 'admin';
  $user-&gt;setPassword('admin');
  $user-&gt;generateAuthKey();
  if ($user-&gt;validate()) {
       $user-&gt;save();
  } else {
       return var_dump($user-&gt;errors);
  }
  </code></pre>
  <p>And as a result I get an error:</p>
  <pre><code>array(3) {
      [&quot;status&quot;]=&gt; array(1) {
          [0]=&gt; string(29) &quot;Status cannot be blank.&quot;
      }
      [&quot;created_at&quot;]=&gt; array(1) {
          [0]=&gt; string(56) &quot;Created At cannot be blank.&quot;
      }
      [&quot;updated_at&quot;]=&gt; array(1) {
          [0]=&gt; string(60) &quot;Updated At cannot be blank.&quot;
      }
  }
  </code></pre>
  <p>why the default value specified in the model for <code>created_at</code> and <code>status</code> didn't apply? How to correctly specify the default value for attributes?</p>
  <pre><code>['status', 'default', 'value' =&gt; self::STATUS_ACTIVE],
  ['created_at', 'default', 'value' =&gt; 123],
  </code></pre>