Class: Adminish::Model

Inherits:
Object
  • Object
show all
Defined in:
lib/adminish.rb

Instance Method Summary collapse

Constructor Details

#initialize(model, crud = {}) ⇒ Model

Returns a new instance of Model.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/adminish.rb', line 21

def initialize(model, crud = {})
  @title = hm_readable_class(model.name)
  @tag = class_tag(model.name)
  # if crud == {}
  #   # generate crud stuff
  #   # @crud = urls_for_model(model)
  # else
    @crud = crud
  # end
  @attributes = []
  model.columns.each do |atr|
    if is_white_listed(atr.name)
      @attributes.push({tag: atr.name, title: atr.name.gsub("_", " "), type: atr.type})
    end
  end
  puts self.to_yaml
end