[Nitro] Problem getting started with Nitro

Alexandru E. Ungur alexandru at globalterrasoft.ro
Tue Jun 27 03:07:35 EDT 2006


Hi all,

I just discovered Nitro, and I would really like to try it out.
I started with the video tutorials, Part I:
http://www.nitroproject.org/videos/nitro.html
but I encountered a problem which forbids me to complete it... 
I'd really appreciate if you could give me an ideea of what's 
wrong and what can I do to be able to continue with the tutorial.

Here it goes: I followed the tutorial until around the minute
12:30 where I got to define the init_db function. When I try to
actually run it, like this: http://localhost:9999/init_db
this is what I get:

Error
Path: /init_db
wrong number of arguments (1 for 0)


This is the output from "ruby demo.rb":
D, [2006-06-27T09:49:57.300160 #20952] DEBUG -- : Using Memory sessions.
I, [2006-06-27T09:49:58.577305 #20952]  INFO -- : Og uses the Sqlite store.

==> Setup for debug mode
==> Listening at 0.0.0.0:9999. [WEBRICK]
==> Press Ctrl-C to shutdown; Run with --help for options.

[2006-06-27 09:49:59] INFO  WEBrick 1.3.1
[2006-06-27 09:49:59] INFO  ruby 1.8.4 (2005-12-24) [i686-linux]
[2006-06-27 09:49:59] INFO  WEBrick::HTTPServer#start: pid=20952 port=9999
D, [2006-06-27T09:50:32.849900 #20952] DEBUG -- : Rendering '/'.
D, [2006-06-27T09:50:32.850710 #20952] DEBUG -- : Compiling action 'Hello#index'
D, [2006-06-27T09:50:43.952656 #20952] DEBUG -- : Rendering '/init_db'.
D, [2006-06-27T09:50:43.953424 #20952] DEBUG -- : Compiling action 'Hello#init_db'
E, [2006-06-27T09:50:43.994309 #20952] ERROR -- : Error while handling '/init_db'.
E, [2006-06-27T09:50:43.994817 #20952] ERROR -- : wrong number of arguments (1 for 0)
  /usr/local/lib/ruby/gems/1.8/gems/og-0.28.0/lib/og/entity.rb:123:in `initialize'
  /usr/local/lib/ruby/gems/1.8/gems/og-0.28.0/lib/og/entity.rb:123:in `create'
  ./controller.rb:27:in `init_db'
  (eval):6:in `init_db_action'
  /usr/local/lib/ruby/gems/1.8/gems/nitro-0.28.0/lib/nitro/controller.rb:88:in `method_missing'
  /usr/local/lib/ruby/gems/1.8/gems/nitro-0.28.0/lib/nitro/render.rb:127:in `render'
  /usr/local/lib/ruby/gems/1.8/gems/nitro-0.28.0/lib/nitro/adapter/webrick.rb:151:in `do_GET'
  /usr/local/lib/ruby/1.8/webrick/httpservlet/abstract.rb:35:in `service'
  /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
  /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
  /usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
  /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
  /usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'
  /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'
  /usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'
  /usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'
  /usr/local/lib/ruby/gems/1.8/gems/nitro-0.28.0/lib/nitro/adapter/webrick.rb:55:in `start'
  /usr/local/lib/ruby/gems/1.8/gems/nitro-0.28.0/lib/nitro/server/runner.rb:321:in `invoke_server'
  /usr/local/lib/ruby/gems/1.8/gems/nitro-0.28.0/lib/nitro/server/runner.rb:287:in `invoke'
  /usr/local/lib/ruby/gems/1.8/gems/nitro-0.28.0/lib/nitro/server.rb:123:in `run'
  /usr/local/lib/ruby/gems/1.8/gems/nitro-0.28.0/lib/nitro.rb:73:in `start'
  demo.rb:9
  LOGGED FROM: /usr/local/lib/ruby/gems/1.8/gems/nitro-0.28.0/lib/nitro/render.rb:205:in `log_error'
D, [2006-06-27T09:50:43.996436 #20952] DEBUG -- : Rendering '/error'.
D, [2006-06-27T09:50:43.997384 #20952] DEBUG -- : Compiling action 'Hello#error'
D, [2006-06-27T09:50:43.998540 #20952] DEBUG -- : Compiling template 'Hello: /usr/local/lib/ruby/gems/1.8/gems/nitro-0.28.0/lib/../proto/public/error.xhtml'
D, [2006-06-27T09:50:44.365414 #20952] DEBUG -- : Rendering '/error'.



I got sqlite3 installed ok, the DB and table were installed OK (I think):
# sqlite3 data.db
SQLite version 3.2.2
Enter ".help" for instructions
sqlite> .schema
CREATE TABLE oguser (name text, description text, age integer, oid integer PRIMARY KEY);
sqlite>

I walked through the entire video all over again, and I noticed no
differences at all between the tutorial and what I did, I will attach
the files as well.


Thank you in advance,
Alex
-------------- next part --------------
class Hello
  def index
    %{
      Hello World
      <br />
      <a href="test">test</a>
      <br />
      <a href="list">list</a>
    }
  end

  def test(name, password)
    %{
      The time is now #{Time.now}
      <br />
      <br />
      The name is #{name}<br />
      The password is #{password}
    }
  end

  def another
    @hello = 'hello from controller'
  end

  def init_db
    User.create 'alex'
    User.create 'ioana'
    User.create 'gigi'
    redirect_to_referer
  end
end
-------------- next part --------------
require 'rubygems'
require 'nitro'
require 'og'

require 'model'
require 'controller'

Og.start
Nitro.start Hello
-------------- next part --------------
class User
  property :name, String
  property :description, String
  property :age, Fixnum

  def inititialize(name)
    @name = name
  end
end


More information about the Nitro-general mailing list