Class: Dock::Cequel

Inherits:
Base
  • Object
show all
Defined in:
lib/dock/adapters/cequel.rb

Instance Attribute Summary

Attributes inherited from Base

#model

Instance Method Summary collapse

Methods inherited from Base

#embedded, inherited, #initialize, #scoped

Constructor Details

This class inherits a constructor from Dock::Base

Instance Method Details

#all(options = {}) ⇒ Object



16
17
18
# File 'lib/dock/adapters/cequel.rb', line 16

def all(options = {})
    construct_scope(options).to_a
end

#associationsObject



32
33
34
# File 'lib/dock/adapters/cequel.rb', line 32

def associations()

end

#belongs_toObject



48
49
50
# File 'lib/dock/adapters/cequel.rb', line 48

def belongs_to()

end

#column_namesObject



38
39
40
# File 'lib/dock/adapters/cequel.rb', line 38

def column_names
  model.columns.map { |column| column.name }
end

#count(options = {}) ⇒ Object

Checked



42
43
44
# File 'lib/dock/adapters/cequel.rb', line 42

def count(options = {})
  all(options).count
end

#create(attributes = {}) ⇒ Object



5
6
7
# File 'lib/dock/adapters/cequel.rb', line 5

def create(attributes = {})
  model.create(attributes)
end

#cyclic?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/dock/adapters/cequel.rb', line 60

def cyclic?
  false
end

#destroy(record) ⇒ Object



29
30
31
# File 'lib/dock/adapters/cequel.rb', line 29

def destroy(record)
  record.destroy
end

#embedded?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/dock/adapters/cequel.rb', line 57

def embedded?
  false
end

#encodingObject



45
46
47
# File 'lib/dock/adapters/cequel.rb', line 45

def encoding
  'UTF-8'
end

#find(key_values) ⇒ Object



8
9
10
11
12
# File 'lib/dock/adapters/cequel.rb', line 8

def find(key_values)
  find!(key_values)
rescue Cequel::Record::RecordNotFound
  nil
end

#find!(key_values) ⇒ Object



13
14
15
# File 'lib/dock/adapters/cequel.rb', line 13

def find!(key_values)
  model.find(*key_values)
end

#first(options = {}) ⇒ Object



19
20
21
# File 'lib/dock/adapters/cequel.rb', line 19

def first(options = {})
  construct_scope(options).first
end

#has_manyObject



51
52
53
# File 'lib/dock/adapters/cequel.rb', line 51

def has_many()

end

#idObject



22
23
24
# File 'lib/dock/adapters/cequel.rb', line 22

def id
  'id'
end

#model_nameObject



35
36
37
# File 'lib/dock/adapters/cequel.rb', line 35

def model_name
  model.class.name
end

#propertiesObject



66
67
68
# File 'lib/dock/adapters/cequel.rb', line 66

def properties()

end

#scoped?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/dock/adapters/cequel.rb', line 54

def scoped?
  false
end

#supports_joins?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/dock/adapters/cequel.rb', line 63

def supports_joins?
  false
end

#update(search_key, find_by, update_key, by_value) ⇒ Object



25
26
27
28
# File 'lib/dock/adapters/cequel.rb', line 25

def update(search_key, find_by, update_key, by_value)
  entry = model.find(update_key).posts.find(find_by)
  entry.update_attributes!(update_key by_value)
end