You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
lucasrenan edited this page Sep 14, 2010
·
2 revisions
Models examples
class Author < CouchRest::Model::Base
property :name
timestamps!
end
class Post < CouchRest::Model::Base
belongs_to :author
property :title
property :content
timestamps!
view_by :title
end
A Post belongs to an Author
a = Author.new(:name => "Lucas")
a.save
p = Post.new(:title => "A blog post")
p.author = a
p.save
p.author.name # => "Lucas"