Sha256: ddb9c6c849b17f840394035e993e1e9604e18f491b4ab70b4e661ce14b54118d

Contents?: true

Size: 758 Bytes

Versions: 24

Compression:

Stored size: 758 Bytes

Contents

module Brightcontent
  module BaseControllerExt
    module Fields
      extend ActiveSupport::Concern

      included do
        %w[list_fields filter_fields form_fields default_fields].each do |name|
          class_eval <<-RUBY, __FILE__, __LINE__ + 1
            def self.#{name}(*fields)
              define_method(:#{name}) { fields.flatten }
            end
            helper_method :#{name}
          RUBY
        end
      end

      protected

      def list_fields
        default_fields
      end

      def filter_fields
        []
      end

      def form_fields
        default_fields
      end

      def default_fields
        resource_class.brightcontent_columns - %w{id created_at updated_at password_digest}
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
brightcontent-core-2.6.0 lib/brightcontent/base_controller_ext/fields.rb
brightcontent-core-2.5.1 lib/brightcontent/base_controller_ext/fields.rb
brightcontent-core-2.5.0 lib/brightcontent/base_controller_ext/fields.rb
brightcontent-core-2.4.6 lib/brightcontent/base_controller_ext/fields.rb
brightcontent-core-2.4.5 lib/brightcontent/base_controller_ext/fields.rb
brightcontent-core-2.4.4 lib/brightcontent/base_controller_ext/fields.rb
brightcontent-core-2.4.3 lib/brightcontent/base_controller_ext/fields.rb
brightcontent-core-2.4.2 lib/brightcontent/base_controller_ext/fields.rb
brightcontent-core-2.4.1 lib/brightcontent/base_controller_ext/fields.rb
brightcontent-core-2.4.0 lib/brightcontent/base_controller_ext/fields.rb
brightcontent-core-2.3.4 lib/brightcontent/base_controller_ext/fields.rb
brightcontent-core-2.3.3 lib/brightcontent/base_controller_ext/fields.rb
brightcontent-core-2.3.2 lib/brightcontent/base_controller_ext/fields.rb
brightcontent-core-2.3.1 lib/brightcontent/base_controller_ext/fields.rb
brightcontent-core-2.3.0 lib/brightcontent/base_controller_ext/fields.rb
brightcontent-core-2.2.2 lib/brightcontent/base_controller_ext/fields.rb
brightcontent-core-2.2.1 lib/brightcontent/base_controller_ext/fields.rb
brightcontent-core-2.2.0 lib/brightcontent/base_controller_ext/fields.rb
brightcontent-core-2.1.5 lib/brightcontent/base_controller_ext/fields.rb
brightcontent-core-2.1.4 lib/brightcontent/base_controller_ext/fields.rb