Sha256: 0c98a9ee251984f6f21f9628ca4675b29f2faacb08415cb5e06467fed7b2cb71

Contents?: true

Size: 771 Bytes

Versions: 18

Compression:

Stored size: 771 Bytes

Contents

require 'active_support/concern'
require 'action_controller'
require 'action_controller/metal/params_wrapper'

module ActionController
  module ParamsWrapper
    class Options # :nodoc:
      undef :include

      def include
        return super if @include_set

        m = model
        synchronize do
          return super if @include_set

          @include_set = true

          unless super || exclude

            if m.respond_to?(:accessible_attributes) && m.accessible_attributes(:default).present?
              self.include = m.accessible_attributes(:default).to_a
            elsif m.respond_to?(:attribute_names) && m.attribute_names.any?
              self.include = m.attribute_names
            end
          end
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
protected_attributes_continued-1.9.0 lib/action_controller/accessible_params_wrapper.rb
protected_attributes_continued-1.8.2 lib/action_controller/accessible_params_wrapper.rb
protected_attributes_continued-1.8.1 lib/action_controller/accessible_params_wrapper.rb
protected_attributes_continued-1.8.0 lib/action_controller/accessible_params_wrapper.rb
protected_attributes_continued-1.7.0 lib/action_controller/accessible_params_wrapper.rb
protected_attributes_continued-1.6.0 lib/action_controller/accessible_params_wrapper.rb
protected_attributes_continued-1.5.0 lib/action_controller/accessible_params_wrapper.rb
protected_attributes_continued-1.4.0 lib/action_controller/accessible_params_wrapper.rb
protected_attributes_continued-1.3.0 lib/action_controller/accessible_params_wrapper.rb
protected_attributes-1.1.4 lib/action_controller/accessible_params_wrapper.rb
protected_attributes_continued-1.2.4 lib/action_controller/accessible_params_wrapper.rb
protected_attributes_continued-1.2.3 lib/action_controller/accessible_params_wrapper.rb
protected_attributes_continued-1.2.2 lib/action_controller/accessible_params_wrapper.rb
protected_attributes_continued-1.2.1 lib/action_controller/accessible_params_wrapper.rb
protected_attributes_continued-1.2.0 lib/action_controller/accessible_params_wrapper.rb
protected_attributes-1.1.3 lib/action_controller/accessible_params_wrapper.rb
protected_attributes-1.1.2 lib/action_controller/accessible_params_wrapper.rb
protected_attributes-1.1.1 lib/action_controller/accessible_params_wrapper.rb