Change model's default ORDER BY column

edited June 2012 in Installation
Hi everybody. I'm new to Fuel (and anything CodeIgniter-related). Everything has gone pretty smoothly until setting up models (besides hiding '/index.php', but that's for another day). I'm converting an existing site to Fuel, and this site already has a database. I've connected to it successfully (I think), as Fuel has made its own tables for the admin and whatnot without complains.

My problem is that the default model behavior is to sort a table by `id`, but this site's tables are set up with a `UID` column as the primary key instead. I tried to send array('key_field' => 'UID') as a constructor argument, and I also tried adding a 'default_col' => 'UID' in the MY_fuel_modules.php file, neither of which is doing anything.

How do I change this behavior?

Comments

  • edited 11:29AM
    You may also need to change the list_items method on your model to use the UID instead of id. To do so, just set a db select statement in the method. If the model doesn't have that method, you can create it. Look at the fuel/modules/blog/models/blog_posts_model for an example of the list_items method.
Sign In or Register to comment.