Hello
I am writing a RoR application which connects to a noSQL database
(couchDB).
In the database, I have an author document. The author has a first_name
and a last_name. It also have inside another document: a book. The book
has a title and a year of publication.
Example:
{
author {
"first_name" : "abc",
"last_name" : "def"
"book" {
"title" : "the jungle book",
"year" : "1922"
}
}
}
I am trying to define the Author model file so I can access Author''s
information as so related book information:
class Author < CouchRest::Model::Base
property :first_name
property :last_name
property :book
...
end
However, when in the HTML file I try to access to the book author''s
information, I get errors.
HTML example:
<td><%=h author.first_name %> <%=h author.last_name %> <%=h
author.book.title %></td>
The error I get is:
undefined method `title'' for :book:Symbol
It''s the first time I am developing a RoR application using a CouchDB
application, so I am pretty sure that the problem comes from the way I
am defining the Author''s model file.
Can anyone help me about that?
Thank you
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.