CodeIgniter Forums
Gas ORM Version 2 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Gas ORM Version 2 (/showthread.php?tid=59676)



Gas ORM Version 2 - El Forum - 11-04-2013

[eluser]Unknown[/eluser]
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
Code:
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.