From: George Moschovitis Date: 2006-07-29T16:29:26+09:00 Subject: Re: [ANN] Nitro/Og 0.31.0 Let me present another more elegant example of Nitro: require 'nitro_and_og' class Content attr_accessor :title, :body, String attr_accessor :hits, Fixnum def initialize(title) @title = title end end class Category < Content attr_accessor :wow, String has_many :posts end class Post < Content belongs_to :category end class Demo def categories(oid) category = Category[oid] print " end def init_db c1 = Category.create('Hello') c2 = Categroy.create('World') post = Post.new('Hello world') post.category = c1 post.save end end Og.start Nitro.start Demo hit http://localhost:9999/init_db to put dummy data in the database (sqlite used by default) hit http://localhost:9999/categories/1 to view the posts in category 1. Notice how nitro automatically handles nice urls. Also note that you could (and should) use a separate xhtml template (view) to handle the page rendering instead of using print statements (or the programmatic builder). But you really have to experiment with Nitro, there are so many features/options. regards, George. -- http://www.nitroproject.org