Search code examples
phpcakephpslug

cakephp sluggable field won't display in indiex after being changed from 'name' to 'title'


I recently started using a sluggable behavior I got out of the bakery. It's default config uses the field 'title' to create the slug. So I changed the field name in my mysql table from 'name' to 'title', instead of making a config change.

The problem I have now is that I can't get the index page for these models to display any records from this table. The paginate function works, and states showing 1 of 30 records, but nothing displays in index table.

So, I changed the table field back to 'name' and made a change to the config so that 'label=>'name', but that also didn't work. It's as though it's stuck on 'title' now.

I even removed the 'acts as sluggable', and still no change.

Any ideas as to why the changing of one field name prevents an index of display any records, but the paginate will?

Always, help is much appreciated.

Paul


Solution

  • Usually when that happens it's because the cached table schema doesn't correspond with the new schema. So when the paginate() call tries to perform a find, the query errors out due to an unrecognized column name. Try to clear the files in /app/tmp/cache/models. And enable debugging like Nik suggests.