Class: Caboose::PageCustomField

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/caboose/page_custom_field.rb

Constant Summary collapse

FIELD_TYPE_TEXT =
'text'
FIELD_TYPE_SELECT =
'select'
FIELD_TYPE_CHECKBOX =
'checkbox'
FIELD_TYPE_DATE =
'date'
FIELD_TYPE_DATETIME =
'datetime'

Instance Method Summary collapse

Instance Method Details

#duplicate(site_id) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/models/caboose/page_custom_field.rb', line 21

def duplicate(site_id)
  f = Caboose::PageCustomField.where(:site_id => site_id, :key => self.key).first
  if f.nil?      
    f = Caboose::PageCustomField.create(
      :site_id       => site_id            , 
      :key           => self.key           , 
      :name          => self.name          ,
      :field_type    => self.field_type    ,
      :default_value => self.default_value ,
      :options       => self.options       ,
      :sort_order    => self.sort_order
    )
  end
  return f
end