Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catalog#additional_response_formats should be a protected method as it's... #770

Merged
merged 1 commit into from
Feb 11, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions lib/blacklight/catalog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,6 @@ def index
additional_response_formats(format)
end
end

def additional_response_formats format
blacklight_config.index.respond_to.each do |key, config|
format.send key do
case config
when false
raise ActionController::RoutingError.new('Not Found')
when Hash
render config
when Proc
instance_exec &config
when Symbol, String
send config
else
# no-op, just render the page
end
end
end
end

# get single document from the solr index
def show
Expand Down Expand Up @@ -169,6 +150,25 @@ def sms
# non-routable methods ->
#

def additional_response_formats format
blacklight_config.index.respond_to.each do |key, config|
format.send key do
case config
when false
raise ActionController::RoutingError.new('Not Found')
when Hash
render config
when Proc
instance_exec &config
when Symbol, String
send config
else
# no-op, just render the page
end
end
end
end

# override this method to change the JSON response from #index
def render_search_results_as_json
{response: {docs: @document_list, facets: search_facets_as_json, pages: pagination_info(@response)}}
Expand Down