Module: EngineRoom::ModelsHelper

Defined in:
app/helpers/engine_room/models_helper.rb

Instance Method Summary collapse

Instance Method Details

#get_form_field_for_column(form, element, column) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/helpers/engine_room/models_helper.rb', line 4

def get_form_field_for_column(form, element, column)

  if column.primary || column.name == "created_at" || column.name == "updated_at"
    element[column.name]
  else 
    
    if [:string, :integer, :datetime].include?(column.type)
      form.text_field column.name
    elsif [:text].include?(column.type)
      form.text_area column.name, :class => "bespind", :rows => 5
    else
      column.type
    end
  end
end