Module: FmStore::Layout::ClassMethods

Defined in:
lib/fm_store/layout.rb

Instance Method Summary collapse

Instance Method Details

#find_fm_name(attribute_name) ⇒ Object

Return the real FileMaker, nil otherwise



34
35
36
37
38
39
40
41
42
# File 'lib/fm_store/layout.rb', line 34

def find_fm_name(attribute_name)
  if fields.has_key?(attribute_name)
    return attribute_name
  else
    f = fields.find { |a| a.last.name == attribute_name }

    f.last.fm_name if f
  end
end

#find_fm_type(attribute_name) ⇒ Object



44
45
46
47
48
# File 'lib/fm_store/layout.rb', line 44

def find_fm_type(attribute_name)
  f = fields.find { |a| a.last.name == attribute_name }

  f.last.type if f
end

#firstObject



65
66
67
# File 'lib/fm_store/layout.rb', line 65

def first
  limit(1).first
end

#fm_fieldsObject

Calling self.fields will ideally match here See FieldControl



28
29
30
31
# File 'lib/fm_store/layout.rb', line 28

def fm_fields
  conn = Connection.establish_connection(self)
  rs = conn.any.first.keys.inspect
end

#identityObject



54
55
56
# File 'lib/fm_store/layout.rb', line 54

def identity
  fields.map(&:last).find(&:identity).try(:fm_name) || "-recid"
end

#searchable_fieldsObject



50
51
52
# File 'lib/fm_store/layout.rb', line 50

def searchable_fields
  fields.map(&:last).select(&:searchable).map(&:name)
end

#set_database(database) ⇒ Object



22
23
24
# File 'lib/fm_store/layout.rb', line 22

def set_database(database)
  self.database = database
end

#set_layout(layout) ⇒ Object



18
19
20
# File 'lib/fm_store/layout.rb', line 18

def set_layout(layout)
  self.layout = layout
end

#value_listsObject



60
61
62
63
# File 'lib/fm_store/layout.rb', line 60

def value_lists
  conn = Connection.establish_connection(self)
  conn.value_lists
end