oh, and I’m not saying that every gem I listed is required, but if you need to reference what version of which gem I have, there ya go
Been jumping through some hoops getting the ruby APIs to work with the 2.0 preview. This post covers the rails tutorial (git://github.com/rumblelabs/couchbase-squish.git) when using the ruby api (make sure to use the latest memcached gem (listed below) if you are on RHEL/Ubuntu/Amazon/etc) for the 2.0 preview.
For clarity (and certainly not for brevity) here is my gem list:
actionmailer (3.1.1, 3.1.0)
actionpack (3.1.1, 3.1.1.rc3, 3.1.0)
active_support (3.0.0)
activemodel (3.1.1, 3.1.1.rc3, 3.1.0)
activerecord (3.1.1, 3.1.0)
activeresource (3.1.1, 3.1.0)
activesupport (3.1.1, 3.1.1.rc3, 3.1.0, 3.0.0)
allison (2.0.3)
ansi (1.3.0)
arel (2.2.1)
bcrypt-ruby (3.0.1, 3.0.0)
builder (3.0.0)
bundle (0.0.1)
bundler (1.0.21)
coffee-rails (3.1.0)
coffee-script (2.2.0)
coffee-script-source (1.1.2)
columnize (0.3.2)
couchbase (0.9.7)
curb (0.7.15)
echoe (4.6.3)
erubis (2.7.0)
execjs (1.2.4)
foreman (0.22.0)
gemcutter (0.7.0)
hike (1.2.1)
i18n (0.6.0)
jquery-rails (1.0.13)
json (1.6.1)
json_pure (1.6.1)
linecache (0.43)
mail (2.3.0)
memcached (1.3.3)
metaclass (0.0.1)
mime-types (1.16)
minitest (2.6.1)
mocha (0.10.0)
multi_json (1.0.3)
polyglot (0.3.2)
rack (1.3.4, 1.3.2)
rack-cache (1.1, 1.0.3)
rack-mount (0.8.3)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.1.0)
railties (3.1.1, 3.1.0)
rake (0.9.2)
rbx-require-relative (0.0.5)
rdoc (3.9.4)
ruby-debug (0.10.4)
ruby-debug-base (0.10.4)
ruby-graphviz (1.0.0)
rubyforge (2.0.4)
sass (3.1.7)
sass-rails (3.1.0)
sprockets (2.0.2, 2.0.0)
term-ansicolor (1.0.6)
therubyracer-heroku (0.8.1.pre3)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
turn (0.8.2)
tzinfo (0.3.30, 0.3.29)
uglifier (1.0.3)
validate_url (0.2.0)
yaji (0.0.9)
yajl-ruby (0.8.3)
And here is the diff of the stuff I changed to get the example to work. I’m sure there is a nicer format to share this info, if someone let’s me know for next time… I know there are a few whitespace changes I made that don’t have a real impact, sorry, but I don’t have the time to pretty it up further.
Cheers
diff --git a/Gemfile b/Gemfile index 35811c5..5a6f5ba 100644 --- a/Gemfile +++ b/Gemfile @@ -25,7 +25,7 @@ group :test do end # Squish Application Dependancies -gem "couchbase-ruby-client", :require => "couchbase" +gem "couchbase", :require => "couchbase" gem "validate_url" diff --git a/Gemfile.lock b/Gemfile.lock index a7128c9..041df8b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -42,10 +42,10 @@ GEM execjs coffee-script-source (1.1.2) columnize (0.3.2) - couchbase-ruby-client (0.9.5) + couchbase (0.9.7) curb (~> 0.7.15) memcached (~> 1.3) - yaji (~> 0.0.5) + yaji (~> 0.0.9) yajl-ruby (~> 0.8.2) curb (0.7.15) erubis (2.7.0) @@ -64,7 +64,7 @@ GEM i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) - memcached (1.3) + memcached (1.3.3) mime-types (1.16) multi_json (1.0.3) polyglot (0.3.2) @@ -107,7 +107,7 @@ GEM sprockets (2.0.0) hike (~> 1.2) rack (~> 1.0) - tilt (!= 1.3.0, ~> 1.1) + tilt (~> 1.1, != 1.3.0) term-ansicolor (1.0.6) therubyracer-heroku (0.8.1.pre3) thor (0.14.6) @@ -131,7 +131,7 @@ PLATFORMS DEPENDENCIES coffee-rails (~> 3.1.0) - couchbase-ruby-client + couchbase foreman jquery-rails rails (= 3.1.0) diff --git a/app/models/link.rb b/app/models/link.rb index a58e604..7128429 100644 --- a/app/models/link.rb +++ b/app/models/link.rb @@ -74,22 +74,26 @@ class Link end @@design_doc = { - 'by_view_count' => { - 'map' => 'function(doc){ if(doc.type == "link"){ emit(doc.views, doc); }}', - }, - 'by_session_id' => { - 'map' => 'function(doc){ if(doc.type == "link" && doc.session_id != null){ emit(doc.session_id, doc); }}', - }, - 'by_created_at' => { - 'map' => 'function(doc){ if(doc.type == "link" && doc.created_at != null){ emit(doc.created_at, doc); }}', - } - } + '_id' => '_design/link', + 'language' => 'javascript', + 'views' => { + 'by_view_count' => { + 'map' => 'function(doc){ if(doc.type == "link"){ emit(doc.views, doc); }}', + }, + 'by_session_id' => { + 'map' => 'function(doc){ if(doc.type == "link" && doc.session_id != null){ emit(doc.session_id, doc); }}', + }, + 'by_created_at' => { + 'map' => 'function(doc){ if(doc.type == "link" && doc.created_at != null){ emit(doc.created_at, doc); }}', + } + } + } if Couch.client.design_docs.include?("link") Couch.client.delete_design_doc('link') - Couch.client.save_design_doc('link', @@design_doc) + Couch.client.save_design_doc(@@design_doc) else - Couch.client.save_design_doc('link', @@design_doc) + Couch.client.save_design_doc(@@design_doc) end def self.popular @@ -107,4 +111,4 @@ class Link results.map { |result| new(result['value']) } end -end \ No newline at end of file +end
Thanks so much for the update! Sorry for the hassle there, some minor changes must have snuck into the most recent version.