def _set_wrapper_defaults(options, model=nil)
options = options.dup
unless options[:include] || options[:exclude]
model ||= _default_wrap_model
if model.respond_to?(:accessible_attributes) && model.accessible_attributes.present?
options[:include] = model.accessible_attributes.to_a
elsif model.respond_to?(:attribute_names) && model.attribute_names.present?
options[:include] = model.attribute_names
end
end
unless options[:name] || self.anonymous?
model ||= _default_wrap_model
options[:name] = model ? model.to_s.demodulize.underscore :
controller_name.singularize
end
options[:include] = Array.wrap(options[:include]).collect(&:to_s) if options[:include]
options[:exclude] = Array.wrap(options[:exclude]).collect(&:to_s) if options[:exclude]
options[:format] = Array.wrap(options[:format])
self._wrapper_options = options
end