Welcome Guest, Not a member yet? Register   Sign In
ActiveRecord for CodeIgniter: Rails-style model interactions
#74

[eluser]beemr[/eluser]
Chromice, Buddy Bradley, et al. Muchos gracias for the great library.

Question: How can I access the ActiveRecord join relationships to get field metadata across tables?

For my own project, I've made a library which uses MySQL "show full columns" to assist in building forms. As it has developed, I've placed it into ActiveRecord 0.7 so it would be available for all of my models. If I can figure it out, I'd like it to access related tables through the ActiveRecord relationships.

I'd like to be able to do this:
$this->user->join_profiles()->field_meta_public(TRUE)
and receive form attributes for all of the "public" fields in both tables. Right now, it does this:

In controller:
Code:
$data['fields'] = $this->user->field_meta_public(TRUE);

In view:
Code:
<?php foreach($fields['input'] as $field)
    {
         echo form_input($field);    
    }
?>
<?php foreach($fields['checkbox'] as $field)
    {
         echo form_checkbox($field);    
    }
?>


Messages In This Thread
ActiveRecord for CodeIgniter: Rails-style model interactions - by El Forum - 01-25-2008, 05:20 PM



Theme © iAndrew 2016 - Forum software by © MyBB