examples/simple/lib/articles/entities.rb in nitro-0.2.0 vs examples/simple/lib/articles/entities.rb in nitro-0.3.0
- old
+ new
@@ -1,35 +1,37 @@
-# = Entities for the Articles part.
-#
-#--
# code:
-# George Moschovitis <gm@navel.gr>
+# * George Moschovitis <gm@navel.gr>
#
# (c) 2004 Navel, all rights reserved.
-# $Id: entities.rb 87 2004-10-19 17:27:45Z gmosx $
-#++
+# $Id: entities.rb 118 2004-11-01 10:13:42Z gmosx $
module N
+# gmosx: forward declaration, can we avoid this?
+class Comment; end
+
# = Article
#
class Article
- include N::Entity
- include N::CreateTime
- manage {
prop_accessor String, :title
prop_accessor String, :body
- }
+ prop_accessor Time, :create_time
+ has_many N::Comment, :comments
+
+ def initialize
+ @create_time = Time.now
+ end
end
# = Comment
#
class Comment
- include N::Entity
- include N::Child
- include N::CreateTime
- manage {
prop_accessor String, :body
- }
+ prop_accessor Time, :create_time
+ belongs_to N::Article, :article
+
+ def initialize
+ @create_time = Time.now
+ end
end
end # module