request[‘foovar’] works fine normally ( see illustration code ) but
blows up inside OgAdminController#save (again, just run the attached
sample code )
Run using a fresh darcs get. Am I the only one seeing these problems
with OgAdminController#save? Is nobody using the admin part? Is it
somehow related to using WEBrick or SQLite?
With each new darcs get I put my own workaround into OgAdminController
– replacing request[] with post_params[], after which everything works
fine.
ERROR: Error while handling OgAdminController#save()
ERROR: undefined method `[]’ for nil:NilClass
/Users/rmela/nitro/repo.nitroproject.org/script/lib/…/…/raw/lib/raw/context/request.rb:304:in
`[]’
/Users/rmela/nitro/repo.nitroproject.org/script/lib/…/…/nitro/lib/nitro/part/admin/og/controller.rb:93:in
save' (eval):4:in
call’
(eval):4:in `save’
/Users/rmela/nitro/repo.nitroproject.org/script/lib/…/…/raw/lib/raw/compiler.rb:65:in
`send’
/Users/rmela/nitro/repo.nitroproject.org/script/lib/…/…/raw/lib/raw/compiler.rb:65:in
`save___super’
/Users/rmela/nitro/repo.nitroproject.org/script/lib/…/…/raw/lib/raw/controller/publishable.rb:36:in
`send’
/Users/rmela/nitro/repo.nitroproject.org/script/lib/…/…/raw/lib/raw/controller/publishable.rb:36:in
`method_missing’
/Users/rmela/nitro/repo.nitroproject.org/script/lib/…/…/raw/lib/raw/controller/render.rb:92:in
`send’
/Users/rmela/nitro/repo.nitroproject.org/script/lib/…/…/raw/lib/raw/controller/render.rb:92:in
`render_action’
/Users/rmela/nitro/repo.nitroproject.org/script/lib/…/…/raw/lib/raw/adapter.rb:68:in
`send’
/Users/rmela/nitro/repo.nitroproject.org/script/lib/…/…/raw/lib/raw/adapter.rb:68:in
`handle_context’
/Users/rmela/nitro/repo.nitroproject.org/script/lib/…/…/raw/lib/raw/adapter/webrick.rb:134:in
do_POST' /opt/local/lib/ruby/1.8/webrick/httpservlet/abstract.rb:35:in
send’
/opt/local/lib/ruby/1.8/webrick/httpservlet/abstract.rb:35:in
service' /opt/local/lib/ruby/1.8/webrick/httpserver.rb:104:in
service’
/opt/local/lib/ruby/1.8/webrick/httpserver.rb:65:in run' /opt/local/lib/ruby/1.8/webrick/server.rb:173:in
start_thread’
/opt/local/lib/ruby/1.8/webrick/server.rb:162:in start' /opt/local/lib/ruby/1.8/webrick/server.rb:162:in
start_thread’
/opt/local/lib/ruby/1.8/webrick/server.rb:95:in start' /opt/local/lib/ruby/1.8/webrick/server.rb:92:in
each’
/opt/local/lib/ruby/1.8/webrick/server.rb:92:in start' /opt/local/lib/ruby/1.8/webrick/server.rb:23:in
start’
/opt/local/lib/ruby/1.8/webrick/server.rb:82:in `start’
/Users/rmela/nitro/repo.nitroproject.org/script/lib/…/…/raw/lib/raw/adapter/webrick.rb:57:in
`start’
/Users/rmela/nitro/repo.nitroproject.org/script/lib/…/…/nitro/lib/nitro/application.rb:135:in
start' ./app.rb:34 LOGGED FROM: /Users/rmela/nitro/repo.nitroproject.org/script/lib/../../raw/lib/raw/controller/render.rb:108:in
render_action’
#!/usr/bin/env ruby
require ‘nitro_and_og’
include Nitro
require ‘nitro/part/admin’
class Book
attr_accessor :title, String
many_to_many Author
end
class Author
attr_accessor :name, String
has_many Book
end
Og.start( :adapter => :sqlite, :database => ‘library’,
:create_schema => true, :destroy_schema => true )
class MyController
def index
render_text “admin
Sample Form”
end
def sampleform
render_text "
"
end
def samplepost
render_text “You entered ‘#{request[‘foo’]}’ in the text field”
end
end
app = Application.new
disp=app.dispatcher
disp.root = MyController
app.start