public function loadResource()
{
if ($this->loadedInstance()) {
if (!$this->getResourceInstance()) {
$this->setResourceInstance($this->loadResourceInstance());
}
} elseif ($this->loadedCollection()) {
// Load resources of collection actions (E.g. 'index') here. Even if we don't support $instance->accessibleBy() (see: https://github.com/ryanb/cancan/blob/f2f40c7aac4a00a88651641129eaad71916c1c82/lib/cancan/model_additions.rb#L22)
if (!$this->getCollectionInstance()) {
$this->setCollectionInstance($this->loadCollection());
}
}
}