Skip to content

Commit

Permalink
Merge pull request Veraticus#157 from abullrd/adapter-agnostic
Browse files Browse the repository at this point in the history
Make Dynamoid Adapter Agnostic
  • Loading branch information
loganb committed Oct 2, 2013
2 parents 738f199 + 4b205f2 commit 7f515f1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/dynamoid/adapter.rb
Expand Up @@ -182,7 +182,7 @@ def get_original_id_and_partition id
#
# @since 0.2.0
def result_for_partition(results, table_name)
table = Dynamoid::Adapter::AwsSdk.get_table(table_name)
table = adapter.get_table(table_name)

if table.range_key
range_key_name = table.range_key.name.to_sym
Expand Down Expand Up @@ -243,7 +243,7 @@ def query(table_name, opts = {})

unless Dynamoid::Config.partitioning?
#no paritioning? just pass to the standard query method
Dynamoid::Adapter::AwsSdk.query(table_name, opts)
adapter.query(table_name, opts)
else
#get all the hash_values that could be possible
ids = id_with_partitions(opts[:hash_value])
Expand All @@ -256,7 +256,7 @@ def query(table_name, opts = {})
ids.each do |id|
modified_options[:hash_value] = id

query_result = Dynamoid::Adapter::AwsSdk.query(table_name, modified_options)
query_result = adapter.query(table_name, modified_options)
results += query_result.inject([]){|array, result| array += [result]} if query_result.any?
end

Expand Down
2 changes: 1 addition & 1 deletion lib/dynamoid/document.rb
Expand Up @@ -61,7 +61,7 @@ def hash_key
#
# @since 0.6.1
def count
Dynamoid::Adapter::AwsSdk.count(table_name)
Dynamoid::Adapter.adapter.count(table_name)
end

# Initialize a new object and immediately save it to the database.
Expand Down

0 comments on commit 7f515f1

Please sign in to comment.