diff options
Diffstat (limited to 'core/controllers/rest.php')
-rw-r--r-- | core/controllers/rest.php | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/core/controllers/rest.php b/core/controllers/rest.php index 6e0acbcb..09c85653 100644 --- a/core/controllers/rest.php +++ b/core/controllers/rest.php @@ -49,23 +49,14 @@ abstract class REST_Controller extends Controller { protected $resource_type = null; - public function dispatch($id=null) { + public function dispatch($id) { if ($this->resource_type == null) { throw new Exception("@todo ERROR_MISSING_RESOURCE_TYPE"); } - if ($id != null) { - // @todo this needs security checks - $resource = ORM::factory($this->resource_type, $id); - if (!$resource->loaded) { - return Kohana::show_404(); - } - } else if (request::method() == "get") { - // A null id and a request method of "get" just returns an empty form - // @todo figure out how to handle the input without and id - // @todo do we use put for create and post for update? - $resource = null; - } else { + // @todo this needs security checks + $resource = ORM::factory($this->resource_type, $id); + if (!$resource->loaded) { return Kohana::show_404(); } /** |