Sha256: 627420c608bcf58426deed31dc279a32ac2e93d06445cfc0b9ba207c0fbea43c

Contents?: true

Size: 707 Bytes

Versions: 1

Compression:

Stored size: 707 Bytes

Contents

require 'kitsune/builder'

module Kitsune
  module ActiveRecord  
    def setup_admin
      self.class_eval do
        class_inheritable_hash :kitsune_admin
        self.kitsune_admin = {
          :no_admin => false, 
          :multipart => false, 
          :display => {}, 
          :edit => {}, 
          :reflections => {},
          :fields => {}, 
          :tabs => {},
          :is_sti => false
        }
      end
    end
  
    def admin &block
      setup_admin unless self.respond_to?(:kitsune_admin)
      Kitsune::Builder.generate(self, &block) unless self.kitsune_admin[:no_admin]
    end
  
    def no_admin
      setup_admin
      self.kitsune_admin[:no_admin] = true
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kitsune-0.0.6 lib/kitsune/active_record.rb