Created
February 20, 2013 15:38
-
-
Save spickermann/4996428 to your computer and use it in GitHub Desktop.
CouchbaseModel#count Hässlich wie die Nacht...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Counter < Struct.new(:value) | |
def self.wrap(bucket, result) | |
new(result['value']) | |
end | |
end | |
view :count_all, :include_docs => false, :wrapper_class => Counter | |
def self.count | |
count_all.first.present? ? count_all.first.value : 0 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment