Module: Controller::RestActionsConcernWithPundit
- Extended by:
- ActiveSupport::Concern
- Included in:
- Resource::BaseController
- Defined in:
- app/controllers/concerns/controller/rest_actions_concern_with_pundit.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
28 29 30 31 32 33 |
# File 'app/controllers/concerns/controller/rest_actions_concern_with_pundit.rb', line 28 def create @resource = resource_class.new(permitted_params) @resource.save respond_with @resource, location: after_create_location end |
#destroy ⇒ Object
54 55 56 57 58 59 |
# File 'app/controllers/concerns/controller/rest_actions_concern_with_pundit.rb', line 54 def destroy @resource = load_resource @resource.destroy respond_with @resource, location: after_destroy_location end |
#edit ⇒ Object
41 42 43 44 45 |
# File 'app/controllers/concerns/controller/rest_actions_concern_with_pundit.rb', line 41 def edit @resource = load_resource respond_with @resource end |
#index ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/concerns/controller/rest_actions_concern_with_pundit.rb', line 11 def index if Itsf::Backend.features?(:ransack) @q = collection_scope_with_search_scopes(collection_scope).ransack(params[:q]) @collection = @q.result.page(params[:page]).per(pagination_size) else @collection = collection_scope.page(params[:page]).per(pagination_size) end respond_with @collection end |
#new ⇒ Object
22 23 24 25 26 |
# File 'app/controllers/concerns/controller/rest_actions_concern_with_pundit.rb', line 22 def new @resource = initialize_resource respond_with @resource end |
#show ⇒ Object
35 36 37 38 39 |
# File 'app/controllers/concerns/controller/rest_actions_concern_with_pundit.rb', line 35 def show @resource = load_resource respond_with @resource end |
#update ⇒ Object
47 48 49 50 51 52 |
# File 'app/controllers/concerns/controller/rest_actions_concern_with_pundit.rb', line 47 def update @resource = load_resource @resource.update_attributes(permitted_params) respond_with @resource, location: after_update_location end |