From: Phil Tomson Date: 2006-07-30T06:47:34+09:00 Subject: Re: [ANN] Nitro/Og 0.31.0 On 7/29/06, George Moschovitis wrote: > Let me present another more elegant example of Nitro: > > require 'nitro_and_og' > > class Content > attr_accessor :title, :body, String I get the following error message when I try to run this: nitro_demo.rb:5:in `attr_accessor': String is not a symbol (TypeError) from nitro_demo.rb:5 ...and it does seem to make sense, String is not a symbol... Phil > 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 > >