Module: Kitsune::MongoMapper
- Defined in:
- lib/kitsune/mongo_mapper.rb
Constant Summary collapse
- TRANSPOSE =
{String => :string}
Instance Method Summary collapse
- #admin(&block) ⇒ Object
- #class_name ⇒ Object
- #columns ⇒ Object
- #no_admin ⇒ Object
- #reflections ⇒ Object
- #setup_admin ⇒ Object
Instance Method Details
#admin(&block) ⇒ Object
25 26 27 28 |
# File 'lib/kitsune/mongo_mapper.rb', line 25 def admin &block setup_admin unless self.respond_to?(:kitsune_admin) Kitsune::Builder.generate(self, &block) unless self.kitsune_admin[:no_admin] end |
#class_name ⇒ Object
45 46 47 |
# File 'lib/kitsune/mongo_mapper.rb', line 45 def class_name self.to_s end |
#columns ⇒ Object
35 36 37 38 39 |
# File 'lib/kitsune/mongo_mapper.rb', line 35 def columns self.keys.map do |key, value| FauxColumn.new(key, TRANSPOSE[value.type], key == '_id') end end |
#no_admin ⇒ Object
30 31 32 33 |
# File 'lib/kitsune/mongo_mapper.rb', line 30 def no_admin setup_admin self.kitsune_admin[:no_admin] = true end |
#reflections ⇒ Object
41 42 43 |
# File 'lib/kitsune/mongo_mapper.rb', line 41 def reflections {} end |
#setup_admin ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/kitsune/mongo_mapper.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 => {}, :reflections => {}, :fields => {}, :tabs => {}, :is_sti => false, :disabled => [], :versioned => false, :order_by => nil, :media => nil # class to store images into } end end |