Class: Dock::DataMapper
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#all(options = {}) ⇒ Object
Checked.
- #associations ⇒ Object
- #belongs_to ⇒ Object
-
#column_names ⇒ Object
Checked.
-
#count(options = {}) ⇒ Object
Checked.
-
#create(attributes = {}) ⇒ Object
Checked.
- #cyclic? ⇒ Boolean
-
#destroy(object) ⇒ Object
Checked.
- #embedded? ⇒ Boolean
- #encoding ⇒ Object
-
#find(id) ⇒ Object
Checked.
-
#find!(id) ⇒ Object
Checked.
-
#first(options = {}) ⇒ Object
Checked.
- #has_many ⇒ Object
-
#id ⇒ Object
Checked.
- #model_name ⇒ Object
- #properties ⇒ Object
- #scoped? ⇒ Boolean
- #supports_joins? ⇒ Boolean
-
#update(search_key, find_by, update_key, by_value) ⇒ Object
not supported?.
Methods inherited from Base
#embedded, inherited, #initialize, #scoped
Constructor Details
This class inherits a constructor from Dock::Base
Instance Method Details
#all(options = {}) ⇒ Object
Checked
18 19 20 21 22 23 24 |
# File 'lib/dock/adapters/datamapper.rb', line 18 def all( = {}) conditions, order, limit, offset = extract_conditions!() opts = { :conditions => conditions, :order => order_clause(order) } opts = opts.merge({ :limit => limit }) unless limit.nil? opts = opts.merge({ :offset => offset }) unless offset.nil? model.all opts end |
#associations ⇒ Object
43 44 45 |
# File 'lib/dock/adapters/datamapper.rb', line 43 def associations() end |
#belongs_to ⇒ Object
60 61 62 |
# File 'lib/dock/adapters/datamapper.rb', line 60 def belongs_to() end |
#column_names ⇒ Object
Checked
50 51 52 |
# File 'lib/dock/adapters/datamapper.rb', line 50 def column_names model.properties.map(&:name) end |
#count(options = {}) ⇒ Object
Checked
54 55 56 |
# File 'lib/dock/adapters/datamapper.rb', line 54 def count( = {}) all().count end |
#create(attributes = {}) ⇒ Object
Checked
6 7 8 |
# File 'lib/dock/adapters/datamapper.rb', line 6 def create(attributes = {}) model.create(attributes) end |
#cyclic? ⇒ Boolean
72 73 74 |
# File 'lib/dock/adapters/datamapper.rb', line 72 def cyclic? false end |
#destroy(object) ⇒ Object
Checked
40 41 42 |
# File 'lib/dock/adapters/datamapper.rb', line 40 def destroy(object) object.destroy if valid_object?(object) end |
#embedded? ⇒ Boolean
69 70 71 |
# File 'lib/dock/adapters/datamapper.rb', line 69 def true end |
#encoding ⇒ Object
57 58 59 |
# File 'lib/dock/adapters/datamapper.rb', line 57 def encoding 'UTF-8' end |
#find(id) ⇒ Object
Checked
10 11 12 |
# File 'lib/dock/adapters/datamapper.rb', line 10 def find(id) model.get(id) end |
#find!(id) ⇒ Object
Checked
14 15 16 |
# File 'lib/dock/adapters/datamapper.rb', line 14 def find!(id) model.get!(id) end |
#first(options = {}) ⇒ Object
Checked
26 27 28 29 |
# File 'lib/dock/adapters/datamapper.rb', line 26 def first( = {}) conditions, order = extract_conditions!() model.first :conditions => conditions, :order => order_clause(order) end |
#has_many ⇒ Object
63 64 65 |
# File 'lib/dock/adapters/datamapper.rb', line 63 def has_many() end |
#id ⇒ Object
Checked
31 32 33 |
# File 'lib/dock/adapters/datamapper.rb', line 31 def id # not supported? end |
#model_name ⇒ Object
46 47 48 |
# File 'lib/dock/adapters/datamapper.rb', line 46 def model_name model.class.name end |
#properties ⇒ Object
79 80 81 |
# File 'lib/dock/adapters/datamapper.rb', line 79 def properties() end |
#scoped? ⇒ Boolean
66 67 68 |
# File 'lib/dock/adapters/datamapper.rb', line 66 def scoped? true end |
#supports_joins? ⇒ Boolean
75 76 77 |
# File 'lib/dock/adapters/datamapper.rb', line 75 def supports_joins? false end |
#update(search_key, find_by, update_key, by_value) ⇒ Object
not supported?
34 35 36 37 38 |
# File 'lib/dock/adapters/datamapper.rb', line 34 def update(search_key, find_by, update_key, by_value) entry = all(search_key find_by) entry.attributes = {update_key => by_value} entry.save end |