dynamoid 1.3.4 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +3 -0
  4. data/.travis.yml +32 -7
  5. data/Appraisals +7 -0
  6. data/CHANGELOG.md +69 -2
  7. data/Gemfile +2 -0
  8. data/README.md +108 -28
  9. data/Rakefile +0 -24
  10. data/docker-compose.yml +7 -0
  11. data/dynamoid.gemspec +2 -3
  12. data/gemfiles/rails_4_0.gemfile +2 -3
  13. data/gemfiles/rails_4_1.gemfile +2 -3
  14. data/gemfiles/rails_4_2.gemfile +2 -3
  15. data/gemfiles/rails_5_0.gemfile +1 -1
  16. data/gemfiles/rails_5_1.gemfile +7 -0
  17. data/lib/dynamoid.rb +31 -31
  18. data/lib/dynamoid/adapter.rb +5 -5
  19. data/lib/dynamoid/adapter_plugin/aws_sdk_v2.rb +84 -57
  20. data/lib/dynamoid/associations.rb +21 -12
  21. data/lib/dynamoid/associations/association.rb +19 -3
  22. data/lib/dynamoid/associations/belongs_to.rb +26 -16
  23. data/lib/dynamoid/associations/has_and_belongs_to_many.rb +0 -16
  24. data/lib/dynamoid/associations/has_many.rb +2 -17
  25. data/lib/dynamoid/associations/has_one.rb +0 -14
  26. data/lib/dynamoid/associations/many_association.rb +19 -6
  27. data/lib/dynamoid/associations/single_association.rb +25 -7
  28. data/lib/dynamoid/config.rb +18 -18
  29. data/lib/dynamoid/config/options.rb +1 -1
  30. data/lib/dynamoid/criteria/chain.rb +29 -21
  31. data/lib/dynamoid/dirty.rb +2 -2
  32. data/lib/dynamoid/document.rb +17 -5
  33. data/lib/dynamoid/errors.rb +4 -1
  34. data/lib/dynamoid/fields.rb +6 -6
  35. data/lib/dynamoid/finders.rb +19 -9
  36. data/lib/dynamoid/identity_map.rb +0 -1
  37. data/lib/dynamoid/indexes.rb +41 -54
  38. data/lib/dynamoid/persistence.rb +54 -24
  39. data/lib/dynamoid/railtie.rb +1 -1
  40. data/lib/dynamoid/validations.rb +4 -3
  41. data/lib/dynamoid/version.rb +1 -1
  42. metadata +14 -29
  43. data/gemfiles/rails_4_0.gemfile.lock +0 -150
  44. data/gemfiles/rails_4_1.gemfile.lock +0 -154
  45. data/gemfiles/rails_4_2.gemfile.lock +0 -175
  46. data/gemfiles/rails_5_0.gemfile.lock +0 -180
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 563c512230d5a7f2485b6cf226eff77accfa2a3e
4
- data.tar.gz: e2f88e774032ddf472bc81a2b9e2a5844b61933a
3
+ metadata.gz: a2fdea2ccbdac2b53135bbd2bed6dedc5b501551
4
+ data.tar.gz: 31174f8f8b12baf0b7f40ab573dc7eed0f05d057
5
5
  SHA512:
6
- metadata.gz: 4a9dba2ea759a74d83f27ef984e3ca963230ddebde577084e89324eb69dd08c65c4c19690891e4086bc9cacadb17eaed5c460c03944dcc9db1eb109044ceef91
7
- data.tar.gz: 314ffb14350619c950bd6615d46ccb3ca32383116f1a1dfe0aa39891694575e89d3376051bfac53b4e4a0f584257c0315a334365e5715727bcc767a31c2daa5e
6
+ metadata.gz: 1de8d6315cbef5ce26f26a850cb95669e93a4d4b3e4badc2ea5305e224dcdf4ffcaf66cf2d0cd5baca4e7644b57765bb92cf31f841ed1fed1cc1d6a789433d7a
7
+ data.tar.gz: 33f582e685f63655d6b57c9cb5484eacf71d04634e34829370aff67fc173511c4f26acba4affb151f0774998477577ed8dd0a66f8af8615e41d12797163212ac
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore CHANGED
@@ -69,3 +69,6 @@ Gemfile.lock
69
69
 
70
70
  # For vagrant
71
71
  .vagrant
72
+
73
+ # For Appraisals
74
+ gemfiles/*.gemfile.lock
@@ -1,3 +1,5 @@
1
+ sudo: required
2
+
1
3
  language: ruby
2
4
  rvm:
3
5
  - ruby-2.0.0-p648
@@ -6,26 +8,49 @@ rvm:
6
8
  - ruby-2.3.4
7
9
  - ruby-2.4.1
8
10
  - jruby-9.1.9.0
11
+ gemfile:
9
12
  gemfile:
10
13
  - gemfiles/rails_4_0.gemfile
11
14
  - gemfiles/rails_4_1.gemfile
12
15
  - gemfiles/rails_4_2.gemfile
13
16
  - gemfiles/rails_5_0.gemfile
17
+ - gemfiles/rails_5_1.gemfile
14
18
  matrix:
15
19
  exclude:
16
20
  - rvm: ruby-2.0.0-p648
17
21
  gemfile: gemfiles/rails_5_0.gemfile
22
+ - rvm: ruby-2.0.0-p648
23
+ gemfile: gemfiles/rails_5_1.gemfile
18
24
  - rvm: ruby-2.1.10
19
25
  gemfile: gemfiles/rails_5_0.gemfile
26
+ - rvm: ruby-2.1.10
27
+ gemfile: gemfiles/rails_5_1.gemfile
20
28
  - rvm: ruby-2.4.1
21
29
  gemfile: gemfiles/rails_4_0.gemfile
22
30
  - rvm: ruby-2.4.1
23
31
  gemfile: gemfiles/rails_4_1.gemfile
24
- before_install: gem install bundler -v 1.15.4
25
- install:
26
- - wget http://dynamodb-local.s3-website-us-west-2.amazonaws.com/dynamodb_local_latest.zip --quiet -O spec/dynamodb_temp.zip
27
- - unzip -qq spec/dynamodb_temp.zip -d spec/DynamoDBLocal-latest
28
- - rm spec/dynamodb_temp.zip
29
- script:
32
+
33
+ ### BUILD LIFECYCLE STEPS ###
34
+
35
+ before_install:
36
+ # Debugging: Print out the current docker-compose version.
37
+ - docker-compose --version
38
+
39
+ # If one of your containers does not build for
40
+ # whatever reason it's best to report that now before your tests start
41
+ # otherwise it can be really tricky to debug why tests are failing sometimes.
42
+ - docker ps
43
+
44
+ after_install:
45
+ - gem install bundler -v 1.15.4
30
46
  - bundle install
31
- - bundle exec rake unattended_spec
47
+
48
+ before_script:
49
+ # Start Docker Compose as a daemon
50
+ - docker-compose up -d
51
+
52
+ script:
53
+ - bundle exec rake spec
54
+
55
+ after_script:
56
+ - docker-compose down
data/Appraisals CHANGED
@@ -1,15 +1,22 @@
1
1
  appraise "rails-4-0" do
2
2
  gem "rails", "~> 4.0.0"
3
+ gem "nokogiri", "~> 1.6.8" # can be removed once we drop support for Ruby 2.0.0
3
4
  end
4
5
 
5
6
  appraise "rails-4-1" do
6
7
  gem "rails", "~> 4.1.0"
8
+ gem "nokogiri", "~> 1.6.8" # can be removed once we drop support for Ruby 2.0.0
7
9
  end
8
10
 
9
11
  appraise "rails-4-2" do
10
12
  gem "rails", "~> 4.2.0"
13
+ gem "nokogiri", "~> 1.6.8" # can be removed once we drop support for Ruby 2.0.0
11
14
  end
12
15
 
13
16
  appraise "rails-5-0" do
14
17
  gem "rails", "~> 5.0.0"
15
18
  end
19
+
20
+ appraise "rails-5-1" do
21
+ gem "rails", "~> 5.1.0"
22
+ end
@@ -1,8 +1,75 @@
1
1
  # HEAD
2
2
 
3
+ ## Breaking
4
+
5
+ * N/A
6
+
7
+ ## Improvements
8
+
9
+ * N/A
10
+
11
+ ## Fixes
12
+
13
+ * N/A
14
+
15
+ # 2.0.0
16
+
17
+ ## Breaking
18
+
19
+ Breaking changes in this release generally bring Dynamoid behavior closer to the Rails-way.
20
+
21
+ * Change: [#186](https://github.com/Dynamoid/Dynamoid/pull/186) Consistent behavior for `Model.where({}).all` (@andrykonchin)
22
+ * <= 1.3.x behaviour -
23
+ * load lazily if user specified batch size
24
+ * load all collection into memory otherwise
25
+ * New behaviour -
26
+ * always return lazy evaluated collection
27
+ * It means Model.where({}).all returns Enumerator instead of Array.
28
+ * If you need Array interface you have to convert collection to Array manually with to_a method call
29
+ * Change: [#195](https://github.com/Dynamoid/Dynamoid/pull/195) Failed `#find` returns error (@andrykonchin)
30
+ * <= 1.3.x behaviour - find returns nil or smaller array.
31
+ * New behaviour - it raises RecordNotFound if one or more records can not be found for the requested ids
32
+ * Change: [#196](https://github.com/Dynamoid/Dynamoid/pull/196) Return value of `#save` (@andrykonchin)
33
+ * <= 1.3.x behaviour - save returns self if model is saved successfully
34
+ * New behaviour - it returns true
35
+
36
+ ## Improvements
37
+
38
+ * Feature: [#185](https://github.com/Dynamoid/Dynamoid/pull/185) `where`, finders and friends take into account STI (single table inheritance) now (@andrykonchin)
39
+ * query will return items of the model class and all subclasses
40
+ * Feature: [#190](https://github.com/Dynamoid/Dynamoid/pull/190) Allow passing options to range when defining attributes of the document (@richardhsu)
41
+ * Allows for serialized fields and passing the serializer option.
42
+ * Feature: [#198](https://github.com/Dynamoid/Dynamoid/pull/198) Enhanced `#create` and `#create!` to allow multiple document creation like `#import` (@andrykonchin)
43
+ * `User.create([{name: 'Josh'}, {name: 'Nick'}])`
44
+ * Feature: [#199](https://github.com/Dynamoid/Dynamoid/pull/199) Added `Document.import` method (@andrykonchin)
45
+ * Feature: [#205](https://github.com/Dynamoid/Dynamoid/pull/205) Use batch deletion via `batch_write_item` for `delete_all` (@andrykonchin)
46
+ * Rename: [#205](https://github.com/Dynamoid/Dynamoid/pull/205) `Chain#destroy_all` as `Chain#delete_all`, to better match Rails conventions when no callbacks are run (@andrykonchin)
47
+ * kept the old name as an alias, for backwards compatibility
48
+ * Feature: [#207](https://github.com/Dynamoid/Dynamoid/pull/207) Added slicing by 25 requests in #batch_write_item (@andrykonchin)
49
+ * Feature: [#211](https://github.com/Dynamoid/Dynamoid/pull/211) Improved Vagrant setup for testing (@richardhsu)
50
+ * Feature: [#212](https://github.com/Dynamoid/Dynamoid/pull/212) Add foreign_key option (@andrykonchin)
51
+ * Feature: [#213](https://github.com/Dynamoid/Dynamoid/pull/213) Support Boolean raw type (@andrykonchin)
52
+ * Improved Documentation (@pboling, @andrykonchin)
53
+
54
+ ## Fixes
55
+
56
+ * Bug: [#191](https://github.com/Dynamoid/Dynamoid/pull/191), [#192](https://github.com/Dynamoid/Dynamoid/pull/192) Support lambdas as fix for value types were not able to be used as default values (@andrykonchin)(@richardhsu)
57
+ * Bug: [#202](https://github.com/Dynamoid/Dynamoid/pull/202) Fix several issues with associations (@andrykonchin)
58
+ * setting `nil` value raises an exception
59
+ * document doesn't keep assigned model and loads it from the storage
60
+ * delete call doesn't update cached ids of associated models
61
+ * fix clearing old `has_many` association while add model to new `has_many` association
62
+ * Bug: [#204](https://github.com/Dynamoid/Dynamoid/pull/204) Fixed issue where `Document.where(:"id.in" => [])` would do `Query` operation instead of `Scan` (@andrykonchin)
63
+ * Fixed `Chain#key_present?`
64
+ * Bug: [#205](https://github.com/Dynamoid/Dynamoid/pull/205) Fixed `delete_all` (@andrykonchin)
65
+ * Fixed exception when makes scan and sort key is declared in model
66
+ * Fixed exception when makes scan and any condition is specified in where clause (like Document.where().delete_all)
67
+ * Fixed exception when makes query and sort key isn't declared in model
68
+ * Bug: [#207](https://github.com/Dynamoid/Dynamoid/pull/207) Fixed `#delete` method for case `adapter.delete(table_name, [1, 2, 3], range_key: 1)` (@andrykonchin)
69
+
3
70
  # 1.3.4
4
71
 
5
- Improving
72
+ ## Improvements
6
73
 
7
74
  * Added `Chain#last` method (@andrykonchin)
8
75
  * Added `date` field type (@andrykonchin)
@@ -19,7 +86,7 @@ Improving
19
86
  * Support querying Global/Local Secondary Indices in `where` clause (@richardhsu)
20
87
  * Only query on GSI if projects all attributes in `where` clause (@richardhsu)
21
88
 
22
- Fixes
89
+ ## Fixes
23
90
 
24
91
  * Fix incorrect applying of default field value (#36 and #117, @andrykonchin)
25
92
  * Fix sync table creation/deletion (#160, @mirokuxy)
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in dynamoid.gemspec
4
4
  gemspec
5
+
6
+ gem "pry-byebug", platforms: :ruby
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Dynamoid
2
2
 
3
+ You are viewing the README for the unreleased version 2 of Dynamoid.
4
+
5
+ For version 1.3.x use the [1-3-stable branch](https://github.com/Dynamoid/Dynamoid/blob/1-3-stable/README.md).
6
+
3
7
  Dynamoid is an ORM for Amazon's DynamoDB for Ruby applications. It
4
8
  provides similar functionality to ActiveRecord and improves on
5
9
  Amazon's existing
@@ -10,10 +14,20 @@ DynamoDB is not like other document-based databases you might know, and is very
10
14
 
11
15
  But if you want a fast, scalable, simple, easy-to-use database (and a Gem that supports it) then look no further!
12
16
 
13
- ## Call For Maintainers
14
17
 
15
- Please inquire within.
16
- https://github.com/Dynamoid/Dynamoid/issues/125
18
+ | Project | Dynamoid |
19
+ |------------------------ | ----------------- |
20
+ | gem name | dynamoid |
21
+ | license | MIT |
22
+ | download rank | [![Total Downloads](https://img.shields.io/gem/rt/Dynamoid.png)](https://rubygems.org/gems/dynamoid) |
23
+ | version | [![Gem Version](https://badge.fury.io/rb/dynamoid.png)](http://badge.fury.io/rb/dynamoid) |
24
+ | dependencies | [![Dependency Status](https://gemnasium.com/badges/github.com/Dynamoid/Dynamoid.png)](https://gemnasium.com/github.com/Dynamoid/Dynamoid) |
25
+ | code quality | [![Code Climate](https://codeclimate.com/github/Dynamoid/Dynamoid.png)](https://codeclimate.com/github/Dynamoid/Dynamoid) |
26
+ | continuous integration | [![Build Status](https://secure.travis-ci.org/Dynamoid/Dynamoid.png?branch=master)](https://travis-ci.org/Dynamoid/Dynamoid) |
27
+ | test coverage | [![Coverage Status](https://coveralls.io/repos/github/Dynamoid/Dynamoid/badge.png?branch=master)](https://coveralls.io/github/Dynamoid/Dynamoid?branch=master) |
28
+ | triage helpers | [![Coverage Status](https://www.codetriage.com/dynamoid/dynamoid/badges/users.png)](https://www.codetriage.com/dynamoid/dynamoid) |
29
+ | homepage | [https://github.com/Dynamoid/Dynamoid](https://github.com/Dynamoid/Dynamoid) |
30
+ | documentation | [http://rdoc.info/github/Dynamoid/Dynamoid/frames](http://rdoc.info/github/Dynamoid/Dynamoid/frames) |
17
31
 
18
32
  ## Installation
19
33
 
@@ -124,6 +138,23 @@ By default, fields are assumed to be of type ```:string```. Other built-in types
124
138
  If built-in types do not suit you, you can use a custom field type represented by an arbitrary class, provided that the class supports a compatible serialization interface.
125
139
  The primary use case for using a custom field type is to represent your business logic with high-level types, while ensuring portability or backward-compatibility of the serialized representation.
126
140
 
141
+ #### Note on boolean type
142
+
143
+ The boolean fields are stored as `"t", "f"` strings by default. DynamoDB
144
+ supports boolean type natively. So if you want to use native boolean
145
+ type or already have table with native boolean attribute you can easily
146
+ achieve this with `store_as_native_boolean` option:
147
+
148
+ ```ruby
149
+ class Document
150
+ include DynamoId::Document
151
+
152
+ field :active, :boolean, store_as_native_boolean: true
153
+ end
154
+ ```
155
+
156
+ #### Magic Columns
157
+
127
158
  You get magic columns of id (string), created_at (datetime), and updated_at (datetime) for free.
128
159
 
129
160
  ```ruby
@@ -140,6 +171,8 @@ class User
140
171
  end
141
172
  ```
142
173
 
174
+ #### Default Values
175
+
143
176
  You can optionally set a default value on a field using either a plain value or a lambda:
144
177
 
145
178
  ```ruby
@@ -147,6 +180,8 @@ You can optionally set a default value on a field using either a plain value or
147
180
  field :joined_at, :datetime, {default: ->(){Time.now}}
148
181
  ```
149
182
 
183
+ #### Custom Types
184
+
150
185
  To use a custom type for a field, suppose you have a `Money` type.
151
186
 
152
187
  ```ruby
@@ -159,7 +194,7 @@ To use a custom type for a field, suppose you have a `Money` type.
159
194
 
160
195
  def self.dynamoid_load(serialized_str)
161
196
  # parse serialized representation and return a Money instance
162
- Money.new(...)
197
+ Money.new(1.23)
163
198
  end
164
199
  end
165
200
 
@@ -181,7 +216,7 @@ add a level of indirection for serializing.) Example:
181
216
 
182
217
  class MoneyAdapter
183
218
  def self.dynamoid_load(money_serialized_str)
184
- Money.new(...)
219
+ Money.new(1.23)
185
220
  end
186
221
 
187
222
  def self.dynamoid_dump(money_obj)
@@ -201,8 +236,8 @@ This is especially important if you want to use your custom field as a numeric r
201
236
  number-oriented queries. By default custom fields are persisted as a string attribute, but
202
237
  your custom class can override this with a `.dynamoid_field_type` class method, which would
203
238
  return either `:string` or `:number`.
204
- (DynamoDB supports some other attribute types, but Dynamoid does not yet.)
205
239
 
240
+ DynamoDB may support some other attribute types that are not yet supported by Dynamoid.
206
241
 
207
242
  ### Associations
208
243
 
@@ -214,12 +249,13 @@ The only supported associations (so far) are ```has_many```, ```has_one```, ```h
214
249
  class User
215
250
  include Dynamoid::Document
216
251
 
217
- ...
252
+ # ...
218
253
 
219
254
  has_many :addresses
220
255
  has_many :students, :class => User
221
256
  belongs_to :teacher, :class_name => :user
222
257
  belongs_to :group
258
+ belongs_to :group, :foreign_key => :group_id
223
259
  has_one :role
224
260
  has_and_belongs_to_many :friends, :inverse_of => :friending_users
225
261
 
@@ -228,7 +264,7 @@ end
228
264
  class Address
229
265
  include Dynamoid::Document
230
266
 
231
- ...
267
+ # ...
232
268
 
233
269
  belongs_to :user # Automatically links up with the user model
234
270
 
@@ -245,7 +281,7 @@ Dynamoid bakes in ActiveModel validations, just like ActiveRecord does.
245
281
  class User
246
282
  include Dynamoid::Document
247
283
 
248
- ...
284
+ # ...
249
285
 
250
286
  validates_presence_of :name
251
287
  validates_format_of :email, :with => /@/
@@ -268,7 +304,7 @@ Dynamoid also employs ActiveModel callbacks. Right now, callbacks are defined on
268
304
  class User
269
305
  include Dynamoid::Document
270
306
 
271
- ...
307
+ # ...
272
308
 
273
309
  before_save :set_default_password
274
310
  after_create :notify_friends
@@ -325,6 +361,19 @@ address.city = 'Chicago'
325
361
  address.save
326
362
  ```
327
363
 
364
+ To create multiple documents at once:
365
+
366
+ ```ruby
367
+ User.create([{name: 'Josh'}, {name: 'Nick'}])
368
+ ```
369
+
370
+ There is an efficient and low-level way to create multiple documents
371
+ (without validation and callbacks running):
372
+
373
+ ```ruby
374
+ users = User.import([{name: 'Josh'}, {name: 'Nick'}])
375
+ ```
376
+
328
377
  ### Querying
329
378
 
330
379
  Querying can be done in one of three ways:
@@ -386,21 +435,21 @@ You are able to optimize query with condition for sort key. Following operators
386
435
 
387
436
  ```ruby
388
437
  Address.where(latitude: 10212)
389
- Address.where('latitude.gt': 10212)
390
- Address.where('latitude.lt': 10212)
391
- Address.where('latitude.gte': 10212)
392
- Address.where('latitude.lte': 10212)
393
- Address.where('city.begins_with': 'Lon')
394
- Address.where('latitude.between': [10212, 20000])
438
+ Address.where('latitude.gt' => 10212)
439
+ Address.where('latitude.lt' => 10212)
440
+ Address.where('latitude.gte' => 10212)
441
+ Address.where('latitude.lte' => 10212)
442
+ Address.where('city.begins_with' => 'Lon')
443
+ Address.where('latitude.between' => [10212, 20000])
395
444
  ```
396
445
 
397
446
  You are able to filter results on the DynamoDB side and specify conditions for non-key fields.
398
447
  Following operators are available: `in`, `contains`, `not_contains`:
399
448
 
400
449
  ```ruby
401
- Address.where('city.in': ['London', 'Edenburg', 'Birmingham'])
402
- Address.where('city.contains': [on])
403
- Address.where('city.not_contains': [ing])
450
+ Address.where('city.in' => ['London', 'Edenburg', 'Birmingham'])
451
+ Address.where('city.contains' => [on])
452
+ Address.where('city.not_contains' => [ing])
404
453
  ```
405
454
 
406
455
  ### Consistent Reads
@@ -423,8 +472,42 @@ User.where("created_at.lt" => DateTime.now - 1.day).all
423
472
 
424
473
  It also supports .gte and .lte. Turning those into symbols and allowing a Rails SQL-style string syntax is in the works. You can only have one range argument per query, because of DynamoDB's inherent limitations, so use it sensibly!
425
474
 
475
+ ### Deleting
476
+
477
+ In order to delete some items `delete_all` method should be used.
478
+ Any callback wont be called. Items delete in efficient way in batch.
479
+
480
+ ```ruby
481
+ Address.where(city: "London").delete_all
482
+ ```
483
+
426
484
  ### Global Secondary Indexes
427
485
 
486
+ You can define index with `global_secondary_index`:
487
+
488
+ ```ruby
489
+ class User
490
+ include Dynamoid::Document
491
+
492
+ field :name
493
+ field :age, :number
494
+
495
+ global_secondary_index hash_key: :age
496
+ end
497
+ ```
498
+
499
+ There are following options:
500
+ * `hash_key` - is used as hash key of an index,
501
+ * `range_key` - is used as range key of an index,
502
+ * `projected_attributes` - list of fields to store in an index or has a predefiled value `:keys_only`, `:all`; `:keys_only` is a default,
503
+ * `name` - an index will be created with this name when a table is created; by default name is generated and contains table name and keys names,
504
+ * `read_capacity` - is used when table creates and used as an index capacity; by default equals `Dynamoid::Config.read_capacity`,
505
+ * `write_capacity` - is used when table creates and used as an index capacity; by default equals `Dynamoid::Config.write_capacity`
506
+
507
+ The only mandatory option is `name`.
508
+
509
+ To use index in `Document.where` implicitly you need to project all the fields with option `projected_attributes: :all`.
510
+
428
511
  There are two ways to query Global Secondary Indexes (GSI).
429
512
 
430
513
  #### Explicit
@@ -485,7 +568,7 @@ the table since a query against GSI then a query on base table is still likely f
485
568
 
486
569
  ## Configuration
487
570
 
488
- There are listed all the configuration options:
571
+ Listed below are all configuration options.
489
572
 
490
573
  * `adapter` - usefull only for the gem developers to switch to a new adapter. Default and the only available value is `aws_sdk_v2`
491
574
  * `namespace` - prefix for table names, default is `dynamoid_#{application_name}_#{environment}` for Rails application and `dynamoid` otherwise
@@ -515,11 +598,11 @@ Dynamoid supports basic, ActiveRecord-like optimistic locking on save operations
515
598
 
516
599
  ```ruby
517
600
  class MyTable
518
- ...
601
+ # ...
519
602
 
520
603
  field :lock_version, :integer
521
604
 
522
- ...
605
+ # ...
523
606
  end
524
607
  ```
525
608
 
@@ -598,9 +681,9 @@ Also, without contributors the project wouldn't be nearly as awesome. So many th
598
681
 
599
682
  ## Running the tests
600
683
 
601
- Running the tests is fairly simple. You should have an instance of DynamoDB running locally. Follow this steps to be able to run the tests:
684
+ Running the tests is fairly simple. You should have an instance of DynamoDB running locally. Follow these steps to setup your test environment.
602
685
 
603
- * First download and unpack the latest version of DynamoDB.
686
+ * First download and unpack the latest version of DynamoDB. We have a script that will do this for you if you use homebrew on a Mac.
604
687
 
605
688
  ```shell
606
689
  bin/setup
@@ -624,7 +707,7 @@ Running the tests is fairly simple. You should have an instance of DynamoDB runn
624
707
  bin/stop_dynamodblocal
625
708
  ```
626
709
 
627
- If you want to run all the specs that travis runs, use `bundle exec wwtd`, but first you will need to setup all the rubies, for each of `%w( 2.0.0-p648 2.1.10 2.2.6 2.3.3 2.4.1 jruby-9.1.8.0 )`. WHen you run `bundle exec wwtd` it will take care of starting and stopping the local dynamodb instance.
710
+ If you want to run all the specs that travis runs, use `bundle exec wwtd`, but first you will need to setup all the rubies, for each of `%w( 2.0.0-p648 2.1.10 2.2.6 2.3.3 2.4.1 jruby-9.1.8.0 )`. When you run `bundle exec wwtd` it will take care of starting and stopping the local dynamodb instance.
628
711
 
629
712
  ```shell
630
713
  rvm use 2.0.0-p648
@@ -633,9 +716,6 @@ gem install bundler
633
716
  bundle install
634
717
  ```
635
718
 
636
- [![Build Status](https://travis-ci.org/Dynamoid/Dynamoid.svg)](https://travis-ci.org/Dynamoid/Dynamoid)
637
- [![Coverage Status](https://coveralls.io/repos/Dynamoid/Dynamoid/badge.svg?branch=master&service=github)](https://coveralls.io/github/Dynamoid/Dynamoid?branch=master)
638
-
639
719
  ## Copyright
640
720
 
641
721
  Copyright (c) 2012 Josh Symonds.