# List all records without ruleschecker

**URL:** <https://discourse.cakephp.org/t/list-all-records-without-ruleschecker/7903>\
**Category:** Need Help\
**Created:** [June 5, 2020, 6:01am UTC](https://discourse.cakephp.org/t/list-all-records-without-ruleschecker/7903 "2020-06-05T06:01:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Foggies](https://avatars.discourse-cdn.com/v4/letter/f/a183cd/32.png) [@Foggies](https://discourse.cakephp.org/u/Foggies)\
**Post date:** [June 5, 2020, 6:01am UTC](https://discourse.cakephp.org/t/list-all-records-without-ruleschecker/7903/1 "2020-06-05T06:01:52Z")

</div>

I’m using CakePHP 4 and using bake function. When I save the record from table contacts without user\_id it will save the record but not listed in the index. However, if I save contacts record with user\_id, it will display the record in the index. I believe it is caused by the paginate-\>contain in contacts controller. However, when I removed the code, it will produce an error.

```
    public function index()
{
    $this->paginate = [
        'contain' => ['Users'],
    ];
    $contacts = $this->paginate($this->Contacts);
    $this->set(compact('contacts'));
}

```

I tried to remove this code from the model, and it also produces an error

```
public function buildRules(RulesChecker $rules): RulesChecker
{
    $rules->add($rules->existsIn(['user_id'], 'Users'));

    return $rules;
}

```

How can I list all the record with or without user\_id in contacts index? Thank you.

---

<div class="post-metadata">

**Author:** ![raul338](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/raul338/32/69_2.png) [@raul338](https://discourse.cakephp.org/u/raul338)\
**Post date:** [June 10, 2020, 5:32pm UTC](https://discourse.cakephp.org/t/list-all-records-without-ruleschecker/7903/2 "2020-06-10T17:32:27Z")

</div>

Check out the initialize method in your model. My guess is that the association is set up to do a `INNER JOIN` strategy, and thats why rows without user\_id are not shown.

You can see the SQL queries in debug\_kit sql panel to confirm
