Skip to content

Commit

Permalink
Merge pull request #572 from pulibrary/fix_lograge
Browse files Browse the repository at this point in the history
Fix logging of Uploaded Requests & Fix Site Masthead Editing
  • Loading branch information
tpendragon committed Apr 12, 2019
2 parents b70bee6 + 4b1b913 commit bd301cc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
10 changes: 9 additions & 1 deletion config/initializers/lograge.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# frozen_string_literal: true
Rails.application.configure do
# Implements fix described in https://github.com/roidrage/lograge/issues/92
class ActionDispatch::Http::UploadedFile
def as_json(_options = nil)
%w[headers].each_with_object({}) do |attr, hash|
hash[attr] = send(attr).force_encoding('utf-8')
end
end
end
# Lograge config
config.lograge.enabled = true

Expand All @@ -9,6 +17,6 @@
# This is is useful if you want to log query parameters
config.lograge.custom_options = lambda do |event|
{ ddsource: ["ruby"],
params: event.payload[:params].reject { |k| %w(controller action).include? k } }
params: event.payload[:params].reject { |k| %w[controller action format].include? k } }
end
end
5 changes: 5 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@

mount Blacklight::Engine => '/'
root to: 'spotlight/exhibits#index'
resource :site, only: [:edit, :update], controller: 'spotlight/sites' do
collection do
get '/tags', to: 'sites#tags'
end
end
resources :exhibits, path: '/', only: [:create, :update, :destroy]
match ':exhibit_id/metadata_configuration', to: 'pomegranate/metadata_configurations#update', via: [:patch, :put]

Expand Down
6 changes: 6 additions & 0 deletions spec/routing/exhibits_routing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,10 @@
expect(get("/catalog")).to route_to controller: "catalog", action: "index"
end
end

describe "PATCH /site" do
it "routes to the site controller" do
expect(patch("/site")).to route_to controller: "spotlight/sites", action: "update"
end
end
end

0 comments on commit bd301cc

Please sign in to comment.