Sha256: 3a4c10410ea9d623a3285eaa0de02ec2aba52a1d50cc075cd85f625def4083b7

Contents?: true

Size: 677 Bytes

Versions: 3

Compression:

Stored size: 677 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 => {}, 
          :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

3 entries across 3 versions & 1 rubygems

Version Path
kitsune-0.0.5 lib/kitsune/active_record.rb
kitsune-0.0.4 lib/kitsune/active_record.rb
kitsune-0.0.3 lib/kitsune/active_record.rb