related tables issue

Hi,

I have this

$related['colors'] = 'products_to_colors_model';
$related['capacities'] = 'products_to_capacities_model';
$fields = parent::form_fields($values, $related);

but for some reason "capacities" is not pulling data from the database so no fields on the select combo are selected.
"colors" is working fine.
The data from both related tables are stored on database as expected.

Any toughts?

Thanks in advance!

Comments

  • edited 3:10PM
    You may want to try putting in debugging code in the fuel/application/core/MY_Model.php "form_fields" method around line 1795 or so to see if any options are being returned. You can also put in a debug query like so to see if there is perhaps an issue with the query being generated:
    $CI->$related_model_name->debug_query()
  • edited 3:10PM
    Solved it!
    The problem was on the short name of the model.
    Instead of capacitie_id, it should be capacity_id

    I fixed it by doing a replace, like so

    @preg_replace("/ie_id$/", "y_id", $CI->$related_model->short_name(TRUE, TRUE)).'_id'

    on the "form_fields" method.¡

    Thanks!
Sign In or Register to comment.