Sha256: f547353ce44fa994040d87b06b6be3ed77ed962ca5450a51bf7cc10a8d8c2627

Contents?: true

Size: 531 Bytes

Versions: 2

Compression:

Stored size: 531 Bytes

Contents

module Administrate
  module Field
    class Base
      def initialize(attribute, data, page)
        @attribute = attribute
        @data = data
        @page = page
      end

      def self.permitted_attribute(attr)
        attr
      end

      def name
        attribute.to_s
      end

      def to_partial_path
        "/fields/#{page}/#{field_name}"
      end

      attr_reader :attribute, :data, :page

      protected

      def field_name
        self.class.to_s.split("::").last.underscore
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
administrate-0.0.3 lib/administrate/fields/base.rb
administrate-0.0.2 lib/administrate/fields/base.rb