Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorkkrzyzak
     
    Hi.
    I would like to implement habtm relationship on site_user model. So, site_user has and belongs to many friends (friend should be an alias for site_user model).
    I've tried:
    var $habtm = array('friends'=>array('class_name'=>'SiteUser',
    'association_foreign_key'=>'friend_id',
    'table_name'=>'site_users'));
    but I've got an error:
    Tried 'SELECT site_users.* FROM site_users LEFT OUTER JOIN site_users_site_users ON site_users_site_users.friend_id = site_users.id LEFT OUTER JOIN site_users ON site_users_site_users.site_user_id = site_users.id WHERE site_users.id = 54'. Got: [1066] Not unique table/alias: 'site_users'

    Any hints will be greatly appreciated
    Sorry for my language errors - English isn't my native lang.
    •  
      CommentAuthorbermi
     

    habtm on the same model are only tested in Akelos like

    class Friend extends ActiveRecord {
        public $habtm = array('friends' => array('association_foreign_key' => 'related_id'));
    }
    

    If you could submit a ticket with a failing test including Migrations and Models, we will be able to reproduce your bug.

    Cheers

    Bermi