[Nitro] Og questions
zimba.tm at gmail.com
Fri Aug 5 10:40:50 EDT 2005
I have some stupid questions to ask about Og's functionning. I'm
really a newbie, and thus I'd understand that you don't loose your
time. But I'm also really excited and like to ask anyway.
- Why do I have to tell the relations to Og ?
I've read that active-record uses a dictionnary to find singular and
plural terms. I'm wondering if it could be used to tell the relations
has_many :comments, Comment
belongs_to :post, Post
property :comments, Comment
property :post, Post
- Is it possible to define customized data types and also can they
encapsulate validation ?
Depending of the field of application, you often have a set of data
types that you find everywhere. Typically in web forms. You'll have
the Password, the Country, the Email. Those types also have the same
validation rules all over the place. Maybe something like that :
def Email < String
validate_length :range => 2..100, :msg_long => 'argh'
validate_format :format => /[mysterious_regexp]/, :msg => 'wrong format'
property :email, Email
a = Author.new
a.email = "user at tld.com"
a.email.valid? => true
That's all for today :-P
More information about the Nitro-general