method
_set_wrapper_defaults
v3.2.8 -
Show latest stable
-
0 notes -
Class: ClassMethods
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0
- 3.0.9
- 3.1.0 (0)
- 3.2.1 (0)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 5.0.0.1
- 5.1.7
- 5.2.3
- 6.0.0
- 6.1.3.1
- 6.1.7.7
- 7.0.0
- 7.1.3.2
- 7.1.3.4
- What's this?
_set_wrapper_defaults(options, model=nil)
protected
Hide source
# File actionpack/lib/action_controller/metal/params_wrapper.rb, line 165 def _set_wrapper_defaults(options, model=nil) options = options.dup unless options[:include] || options[:exclude] model ||= _default_wrap_model role = options.has_key?(:as) ? options[:as] : :default if model.respond_to?(:accessible_attributes) && model.accessible_attributes(role).present? options[:include] = model.accessible_attributes(role).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