Skip to content

Commit

Permalink
Get around the wrap_parameters
Browse files Browse the repository at this point in the history
  In rails 5, this is strongly tied to an ActiveModel model and doesn't
  apply to the webhook controller
  • Loading branch information
gburgett committed Mar 19, 2019
1 parent fb6cc1e commit c4243f0
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class WebhookController < ApplicationController
include WCC::Contentful::ServiceAccessors
include Wisper::Publisher

wrap_parameters :webhook, include: [:sys, :fields]
before_action :authorize_contentful
protect_from_forgery unless: -> { request.format.json? }

Expand All @@ -19,9 +18,10 @@ class WebhookController < ApplicationController
end

def receive
event = params.require('webhook').permit!
event.require('sys').require(%w[id type])
event = event.to_h
params.require('sys').require(%w[id type])
params.permit('sys', 'fields').permit!
event = params.slice('sys', 'fields')
event = event.permit!.to_h

return unless check_environment(event)

Expand Down

0 comments on commit c4243f0

Please sign in to comment.