File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 11# Callbacks
22
33You can use the callbacks in the controller to add some logic before, around or after ` set_resource `
4- or ` set_parent_resource ` :
4+ , ` set_parent_resource ` or ` set_all_resources ` :
5+
6+ - The ` set_resource ` method is called in [ : show , : update , : destroy ] actions
7+ - The ` set_parent_resource ` method is called in all actions if you are using nested resources
8+ - The ` set_all_resources ` method is called in [ : index ] actions
59
610``` ruby
711# frozen_string_literal: true
812
913class CarsController < RestApiGenerator ::ResourceController
1014 after_set_resource :authorize_logic
15+ set_all_resources -> { @resources = authorized_resource(@resources ) }
1116
1217 def authorize_logic
1318 # Custom authorization logic
You can’t perform that action at this time.
0 commit comments