Sha256: da8328c1763b9209407dbc56466440159a585d4b0a5cb4bf204c3ce89005359f

Contents?: true

Size: 718 Bytes

Versions: 1

Compression:

Stored size: 718 Bytes

Contents

require 'lib/content'

# The models used in the Blog part.

# Forward reference to the Comment definition. 

class Comment; end

# Common properties/methods for the other classes.
# Since markup is required, automatically handles
# the markup expanding/compacting for the body.

module Common
	include BaseContent
	include CreateTime

	property :author, String
	validate_value :body
end

# An entry in the Blog.

class BlogEntry 
	include Common
	has_many :comments, Comment, :foreign_name => 'entry'
	validate_value :title, :msg => 'Please provide a title'
end

# A comment to the blog entry.

class Comment 
	include Common
	belongs_to :entry, BlogEntry
	validate_value :author, :msg => 'Please enter your name'
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nitro-0.17.0 examples/no_xsl_blog/lib/blog/model.rb