Skip to content

Instantly share code, notes, and snippets.

@svs
Created January 31, 2014 12:20
Show Gist options
  • Save svs/8731067 to your computer and use it in GitHub Desktop.
Save svs/8731067 to your computer and use it in GitHub Desktop.
# Given a table stat with primary key "slug" with data
# [{slug: 'foo', stats: {}}, {slug:'bar', stats:{}}]
updated_stats = {
'foo' => {a: 1, b: 2},
'bar' => {a: 3, b: 4}
}
# I can do this
updated_stats.each{|k,v|
r.table('stats').get(k).update{|s|
{ :stats => updated_stats[k] }
}
}
# so, why can't I do the following?
r.table('stats').get_all(*updated_stats.keys).update{|s|
{ :stats => updated_stats[s["slug"]] }
}
# the rql shows nil as the value of updated_stats[s["slug"]]
# any idea? thanks!
@svs
Copy link
Author

svs commented Feb 6, 2014

@neumino Thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment