Fix #4240: only=… param malfunctioning on autocomplete API.
This commit is contained in:
@@ -17,7 +17,7 @@ class ApplicationResponder < ActionController::Responder
|
||||
options[:root] ||= resource.table_name.dasherize if resource.respond_to?(:table_name)
|
||||
end
|
||||
|
||||
options[:only] ||= params["only"].scan(/\w+/).map(&:to_sym) if params["only"]
|
||||
options[:only] ||= params["only"].scan(/\w+/) if params["only"]
|
||||
|
||||
super
|
||||
end
|
||||
|
||||
@@ -294,6 +294,8 @@ class ApplicationRecord < ActiveRecord::Base
|
||||
options[:include] ||= []
|
||||
options[:methods] ||= []
|
||||
|
||||
options[:only] = options[:only].map(&:to_sym)
|
||||
|
||||
attributes, methods = api_attributes.partition { |attr| has_attribute?(attr) }
|
||||
methods += options[:methods]
|
||||
includes = options[:include]
|
||||
|
||||
Reference in New Issue
Block a user