Skip to content

Commit b6bcc2b

Browse files
committed
Better Controller example for Rails
Take advantage of newer Rails strong params, but also passing strong params in directly like previous example actually messes up the <request> element in response. We should probably debug and fix that, but don't have capacity at present.
1 parent b9c30b3 commit b6bcc2b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/oai/provider.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,16 @@
118118
# ```ruby
119119
# class OaiController < ApplicationController
120120
# def index
121-
# # Remove controller and action from the options. Rails adds them automatically.
122-
# options = params.delete_if { |k,v| %w{controller action}.include?(k) }
123121
# provider = BlogProvider.new
124-
# response = provider.process_request(options)
122+
# response = provider.process_request(oai_params.to_h)
125123
# render :body => response, :content_type => 'text/xml'
126124
# end
125+
#
126+
# private
127+
#
128+
# def oai_params
129+
# params.permit(:verb, :identifier, :metadataPrefix, :set, :from, :until, :resumptionToken)
130+
# end
127131
# end
128132
# ```
129133
#

0 commit comments

Comments
 (0)