Module: Kitsune::ActiveRecord

Defined in:
lib/kitsune/active_record.rb

Instance Method Summary collapse

Instance Method Details

#admin(&block) ⇒ Object



26
27
28
29
# File 'lib/kitsune/active_record.rb', line 26

def admin &block
  setup_admin unless self.respond_to?(:kitsune_admin)
  Kitsune::Builder.generate(self, &block) unless self.kitsune_admin[:no_admin]
end

#no_adminObject



31
32
33
34
# File 'lib/kitsune/active_record.rb', line 31

def no_admin
  setup_admin
  self.kitsune_admin[:no_admin] = true
end

#setup_adminObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/kitsune/active_record.rb', line 5

def setup_admin
  self.class_eval do
    class_inheritable_hash :kitsune_admin
    self.kitsune_admin = {
      :no_admin => false, 
      :multipart => false, 
      :display => {}, 
      :edit => {}, 
      :show => {},
      :reflections => {},
      :fields => {}, 
      :tabs => {},
      :is_sti => false,
	:disabled => [],
	:versioned => false,
	:order_by => nil,
	:media => nil # class to store images into
    }
  end
end