<?php

class AppPluginController extends AppController {

	# ~ beforeFilter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
	public function beforeFilter() {

		# Check if default model is set
		if ($this->modelClass = 'App') {
			$this->modelClass = Inflector::classify(substr(get_class($this), 0, -10));
			//$this->uses = array(ucfirst($this->request->params['plugin']) . '.' . $this->modelClass);
			//throw new Exception('Default model not found for ' . ucfirst($this->request->params['plugin']) . '.' . $this->modelClass);
		}

		$this->{$this->modelClass} = ClassRegistry::init(ucfirst($this->request->params['plugin']) . '.' . $this->modelClass);

		parent::beforeFilter();
	}

}
