Forum: Ruby on Rails CouchDB accessing composed column

D031782a536596736b44eb6da9b316b8?d=identicon&s=25 Paulo Carvalho (pjmorce)
on 2012-05-21 16:34

In my RoR application, I am using Couchrest_model to access a CouchDB

I have a model which represents an scientific Article.
I am going to simplify my model to explain it better. An article can
have a title, a year and one or more authors.

In the couchDB database, an article can be represented like this:

article {
  title = "abc",
  year = "2012",
  author = {
     name = Paulo,
     age = 34

(In the case the article only have an author)


article {
  title = "abc",
  year = "2012",
  author = {
    [0] {
       name = "Paulo",
       age = "34"
    [1] {
       name = "Philippe",
       age = "32"

class Article < CouchRest::Model::Base
  property :title
  property :year
  property :author

In the case my article have only one author, I can access author's
information (name and age) like this:

But, how can I access the information of authors if the article have
more than 1 author?
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.