Ruby on Rails
Thursday, June 7, 2012
There is a recipe for pagination in the couchdb guide
On Thursday, June 7, 2012 at 12:56 AM, Paulo Carvalho wrote:
Hello,In my rails application, I am using couchrest_model to connect to acouchDB database.I have a model like this:[code]class Author < CouchRest::Model::Baseproperty :id, Integerproperty :title, Stringproperty :first_name, Stringproperty :last_name, String# view to get only the documents which starts with "authors" - TableAuthorsview_by :id,:map => "function(doc) {if(doc._id.indexOf('authors') == 0) {emit(null, doc);}}"end[/code]In the controller the function is simple:[code]def list@authors = Author.by_id()end[/code]And in the view I iterate the @authors to show the results.I would like to implement pagination but I don't know how. I alreadyimplemented pagination before, when I was using a PostgreSQL databaseand active records (will_paginate), but now, I am stuck with this.Anyone can help me with a simple example?--Posted via http://www.ruby-forum.com/.--You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.To post to this group, send email to rubyonrails-talk@googlegroups.com.To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment