Class: FieldGroup

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/fields/field_group.rb

Overview

Copyright (c) 2008-2013 Michael Dvorkin and contributors.

Fat Free CRM is freely distributable under the terms of MIT license. See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php

Schema Information

Table name: field_groups

id :integer not null, primary key name :string(64) label :string(128) position :integer hint :string(255) created_at :datetime updated_at :datetime tag_id :integer klass_name :string(32)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.with_tags(tag_ids) ⇒ Object



42
43
44
# File 'app/models/fields/field_group.rb', line 42

def self.with_tags(tag_ids)
  where 'tag_id IS NULL OR tag_id IN (?)', tag_ids
end

Instance Method Details

#keyObject



34
35
36
# File 'app/models/fields/field_group.rb', line 34

def key
  "field_group_#{id}"
end

#klassObject



38
39
40
# File 'app/models/fields/field_group.rb', line 38

def klass
  klass_name.constantize
end

#label_i18nObject



46
47
48
# File 'app/models/fields/field_group.rb', line 46

def label_i18n
  I18n.t(name, default: label)
end