Sha256: 5dfae112c0586623de2573ba28eddc291b253940fb086ac7d60a096453f12808

Contents?: true

Size: 592 Bytes

Versions: 2

Compression:

Stored size: 592 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 html_class
        field_name.dasherize
      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.6 lib/administrate/fields/base.rb
administrate-0.0.4 lib/administrate/fields/base.rb