Flowdock
method

_set_wrapper_defaults

Importance_0
v3.2.1 - Show latest stable - 0 notes - Class: ClassMethods
_set_wrapper_defaults(options, model=nil) protected

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

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
          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
Register or log in to add new notes.