CodeIgniter Forums

Full Version: Gas ORM Version 2
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

Am really getting problems with Gas ORM 2.1.2 when it comes to relationships, I tried searching through the forums bt got nothing. I have copied the exact example from the gas main website but when i call the model in the controller like this
public function show()
                // load all of our posts
    $data['user'] = Model\User::with('blog')->all();
                $data['posts'] = $data['user']->blog();

                // build our blog table
               $this->load->view('all', $data);

But i get this error

Fatal error: Call to a member function blog() on a non-object in C:\wamp\www\CodeIgniter-develop\application\controllers\Welcome.php on line 140

What am i missing or what could be the problem? Please help coz i've falled in love with this orm and i dont want to manually join two tables rather use the rich features of gas orm.