On Tue, Nov 25, 2008 at 11:23 PM, Ezra Zygmuntowicz <[EMAIL PROTECTED]>wrote:

>
>
>        You pretty much cannot have a top level constant named 'Rack' since
> merb framework is built on top of Rack that name is already claimed.
> Sorry you will have to rename your model, maybe EquipmentRack ?
>
> -Ezra
>

Thanks,

I tried to namespace my model with

module Faa
  class Rack
      include DataMapper::Resource
  end
end

and having my router like this

resources :sites do
  resources :racks, :controller => 'faa/racks'
end

This routes correctly and I get the index page working correctly as well as
the new form working but when
I submit to create with the following method

  def create(rack)r
      @rack = Faa::Rack.new(rack)
      if @rack.save
        redirect resource(@site, @rack), :message => {:notice => "Rack was
successfully created"}
      else
        message[:error] = "Rack failed to be created"
        render :new
      end
    end

it gives me this

merb : worker (port 4000) ~ Params: {"site_id"=>"1", "format"=>nil,
"submit"=>"Create", "action"=>"create", "controller"=>"faa/racks", "f
aa::rack"=>{"name"=>"rack 1"}}
merb : worker (port 4000) ~ Dispatching
Merb::ControllerExceptions::BadRequest raised another error.
merb : worker (port 4000) ~ undefined method `[]' for nil:NilClass -
(NoMethodError)
c:/ruby/lib/ruby/gems/1.8/gems/merb-core-1.0.2/lib/merb-core/dispatch/default_exception/views/index.html.erb:78:in
`c____ruby__lib__ruby_
_gems__1_8__gems__merb__core__1_0_2__lib__merb__core__dispatch__default__exception__views__index_html_erb'
c:/ruby/lib/ruby/gems/1.8/gems/merb-core-1.0.2/lib/merb-core/controller/template.rb:202:in
`each_with_index'
c:/ruby/lib/ruby/gems/1.8/gems/merb-core-1.0.2/lib/merb-core/dispatch/default_exception/views/index.html.erb:68:in
`each'
c:/ruby/lib/ruby/gems/1.8/gems/merb-core-1.0.2/lib/merb-core/dispatch/default_exception/views/index.html.erb:68:in
`each_with_index'
c:/ruby/lib/ruby/gems/1.8/gems/merb-core-1.0.2/lib/merb-core/dispatch/default_exception/views/index.html.erb:68:in
`c____ruby__lib__ruby_
_gems__1_8__gems__merb__core__1_0_2__lib__merb__core__dispatch__default__exception__views__index_html_erb'
c:/ruby/lib/ruby/gems/1.8/gems/merb-core-1.0.2/lib/merb-core/controller/template.rb:202:in
`each_with_index'
c:/ruby/lib/ruby/gems/1.8/gems/merb-core-1.0.2/lib/merb-core/dispatch/default_exception/views/index.html.erb:48:in
`each'
c:/ruby/lib/ruby/gems/1.8/gems/merb-core-1.0.2/lib/merb-core/dispatch/default_exception/views/index.html.erb:48:in
`each_with_index'
c:/ruby/lib/ruby/gems/1.8/gems/merb-core-1.0.2/lib/merb-core/dispatch/default_exception/views/index.html.erb:48:in
`c____ruby__lib__ruby_
_gems__1_8__gems__merb__core__1_0_2__lib__merb__core__dispatch__default__exception__views__index_html_erb'
c:/ruby/lib/ruby/gems/1.8/gems/merb-core-1.0.2/lib/merb-core/controller/mixins/render.rb:133:in
`send'
c:/ruby/lib/ruby/gems/1.8/gems/merb-core-1.0.2/lib/merb-core/controller/mixins/render.rb:133:in
`render'
c:/ruby/lib/ruby/gems/1.8/gems/merb-core-1.0.2/lib/merb-core/dispatch/default_exception/default_exception.rb:100:in
`index'
c:/ruby/lib/ruby/gems/1.8/gems/merb-action-args-1.0/lib/merb-action-args/abstract_controller.rb:40:in
`__send__'
c:/ruby/lib/ruby/gems/1.8/gems/merb-action-args-1.0/lib/merb-action-args/abstract_controller.rb:40:in
`_call_action'
c:/ruby/lib/ruby/gems/1.8/gems/merb-core-1.0.2/lib/merb-core/controller/abstract_controller.rb:285:in
`_dispatch'
c:/ruby/lib/ruby/gems/1.8/gems/merb-core-1.0.2/lib/merb-core/controller/merb_controller.rb:252:in
`_dispatch'
c:/ruby/lib/ruby/gems/1.8/gems/merb-core-1.0.2/lib/merb-core/dispatch/dispatcher.rb:142:in
`dispatch_exception'
c:/ruby/lib/ruby/gems/1.8/gems/merb-core-1.0.2/lib/merb-core/dispatch/dispatcher.rb:80:in
`handle'
c:/ruby/lib/ruby/gems/1.8/gems/merb-core-1.0.2/lib/merb-core/dispatch/dispatcher.rb:36:in
`handle'
c:/ruby/lib/ruby/gems/1.8/gems/merb-core-1.0.2/lib/merb-core/rack/application.rb:17:in
`call_without_sass'
c:/ruby/lib/ruby/gems/1.8/gems/haml-2.1.0/lib/sass/plugin/merb.rb:34:in
`call'
c:/ruby/lib/ruby/gems/1.8/gems/merb-core-1.0.2/lib/merb-core/rack/middleware/static.rb:28:in
`call'
c:/ruby/lib/ruby/gems/1.8/gems/merb-core-1.0.2/lib/merb-core/rack/handler/mongrel.rb:82:in
`process'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:159:in
`process_client'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:158:in
`each'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:158:in
`process_client'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:285:in
`run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:285:in
`initialize'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:285:in
`new'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:285:in
`run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:268:in
`initialize'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:268:in
`new'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:268:in
`run'
c:/ruby/lib/ruby/gems/1.8/gems/merb-core-1.0.2/lib/merb-core/rack/adapter/mongrel.rb:38:in
`start_server'
c:/ruby/lib/ruby/gems/1.8/gems/merb-core-1.0.2/lib/merb-core/rack/adapter/abstract.rb:235:in
`start_at_port'
c:/ruby/lib/ruby/gems/1.8/gems/merb-core-1.0.2/lib/merb-core/rack/adapter/abstract.rb:85:in
`start'
c:/ruby/lib/ruby/gems/1.8/gems/merb-core-1.0.2/lib/merb-core/server.rb:174:in
`bootup'
c:/ruby/lib/ruby/gems/1.8/gems/merb-core-1.0.2/lib/merb-core/server.rb:42:in
`start'
c:/ruby/lib/ruby/gems/1.8/gems/merb-core-1.0.2/lib/merb-core.rb:170:in
`start'
c:/ruby/lib/ruby/gems/1.8/gems/merb-core-1.0.2/bin/merb:11
c:/ruby/bin/merb:19:in `load'
c:/ruby/bin/merb:19
merb : worker (port 4000) ~ Params: {"site_id"=>"1", "format"=>nil,
"submit"=>"Create", "action"=>"create", "controller"=>"faa/racks", "f
aa::rack"=>{"name"=>"rack 1"}}
merb : worker (port 4000) ~ Params: {"site_id"=>"1", "format"=>nil,
"submit"=>"Create", "action"=>"create", "controller"=>"faa/racks", "f
aa::rack"=>{"name"=>"rack 1"}}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to