Skip to content

Commit

Permalink
Merge pull request #182 from w-zygmuntowicz/patch-169-error-uploading…
Browse files Browse the repository at this point in the history
…-files

Fix: Move wrap_io_params callback setup from concern to controllers
  • Loading branch information
omohokcoj authored Nov 30, 2024
2 parents 40d2c25 + 59a4304 commit 01d712f
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 01d712f

Please sign in to comment.