module FatFreeCRM::Fields::SingletonMethods
Public Instance Methods
field_groups()
click to toggle source
# File lib/fat_free_crm/fields.rb, line 26 def field_groups # catches cases where this code runs before database has been created or migrated FieldGroup.where(klass_name: name).order(:position) rescue ActiveRecord::NoDatabaseError, ActiveRecord::StatementInvalid [] end
fields()
click to toggle source
# File lib/fat_free_crm/fields.rb, line 33 def fields field_groups.map(&:fields).flatten end
ransack_column_select_options()
click to toggle source
Shows custom field select options in ransack search form
# File lib/fat_free_crm/fields.rb, line 44 def ransack_column_select_options field_groups.each_with_object({}) do |group, hash| group.fields.select { |f| f.collection.present? }.each do |field| hash[field.name] = field.collection.each_with_object({}) do |option, options| options[option] = option end end end end
serialize_custom_fields!()
click to toggle source
# File lib/fat_free_crm/fields.rb, line 37 def serialize_custom_fields! fields.each do |field| serialize(field.name.to_sym, Array) if field.as == 'check_boxes' end end