Sha256: ace5e9ee06864bfca452462fe61791e7b5bb9e2e99fd6008078c98f98726543c

Contents?: true

Size: 426 Bytes

Versions: 7

Compression:

Stored size: 426 Bytes

Contents

module AbAdmin
  module Models
    module Header
      extend ActiveSupport::Concern

      included do
        belongs_to :headerable, :polymorphic => true
      end
      
      def empty?
        [keywords, description, title].map(&:blank?).all?
      end

      def has_info?
        !empty?
      end

      def read(key)
        value = read_attribute(key)
        value.blank? ? nil : value
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ab_admin-0.2.3 lib/ab_admin/models/header.rb
ab_admin-0.2.2 lib/ab_admin/models/header.rb
ab_admin-0.2.1 lib/ab_admin/models/header.rb
ab_admin-0.2.0 lib/ab_admin/models/header.rb
ab_admin-0.1.2 lib/ab_admin/models/header.rb
ab_admin-0.1.1 lib/ab_admin/models/header.rb
ab_admin-0.1.0 lib/ab_admin/models/header.rb