Skip to content

Commit

Permalink
Move wrap_io_params callback setup from concern to controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
w-zygmuntowicz committed Oct 13, 2024
1 parent b3262d9 commit 59a4304
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
6 changes: 0 additions & 6 deletions app/controllers/concerns/motor/wrap_io_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@

module Motor
module WrapIoParams
extend ActiveSupport::Concern

included do
before_action :wrap_io_params, only: %i[update create]
end

private

def wrap_io_params(hash = params)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ module Motor
class ActiveStorageAttachmentsController < ApiBaseController
include Motor::WrapIoParams

before_action :wrap_io_params, only: :create

wrap_parameters :data, except: %i[include fields]

load_and_authorize_resource :attachment, class: 'ActiveStorage::Attachment', parent: false
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/motor/data_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ class DataController < ApiBaseController
include Motor::WrapIoParams
include Motor::LoadAndAuthorizeDynamicResource

before_action :wrap_io_params, only: %i[update create]

def index
@resources = Motor::ApiQuery.call(@resources, params)

Expand Down

0 comments on commit 59a4304

Please sign in to comment.