public function generate_unique_token() { do { $this->token = Model_Auth_User_Token::generate_token(); $collection = Jam::all($this->meta()->model())->where_key($this->token)->limit(1); } while (Jam::all($this)->where('token', '=', $this->token)->limit(1)->count_all() > 0); return $this; }
protected function _init() { parent::_init(); // Overrule the names of the User_Roles model to the Site_... version $this->_fields = array_merge($this->_fields, array('user' => new Sprig_Field_BelongsTo(array('model' => 'Site_User', 'column' => 'site_user_id')))); }
public static function initialize(Jam_Meta $meta) { $meta->db(Kohana::TESTING); parent::initialize($meta); $meta->associations(array('user' => Jam::association('belongsto', array('foreign_model' => 'test_user', 'foreign_key' => 'test_user_id')))); }