how to define property in a module ? (for multiple inheritance)
10 views
Skip to first unread message
Chang Luo
unread,
Sep 15, 2011, 8:24:48 PM9/15/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to CouchRest
Hi,
In my class, I want to include multiple modules. Each module can
define its own property to persist in couchDB.
Here is an example:
module Owner
property :name
end
module Animal
property :type
end
class Cat
include Owner
include Animal
end
This doesn't work. I got this error: "undefined method `property'".
I tried added CouchRest::Model::Embeddable but it won't work for
module either. All the examples I am seeing are extending from
CouchRest::Model::Base. However, I won't be able to use this approach
because Ruby doesn't support multiple inheritance.