The problem with the "new" routing when upgrading from rails 3.2.0 to 3.2.2

I have some problems with routing when upgrading rails from 3.2.0 to 3.2.2.

When creating a new route with the route assistant, the assistant works and generates a link that looks like this:

/things/new

However, when you visit the link, it throws a routing error ...

Routing Error
No route matches {:action=>"edit", :controller=>"app/things", :id=>#<Thing id: nil, title: n....

He is mistaken in the fact that URL editing actions are not new.

There is nothing in the routes, but ....

  scope :module => :app, :as => :app, :constraints => { :subdomain => /app/ } do
     resources :things
  end

Has anyone experienced this or knew what was going on?

Thank.

Additional information...

Route routes:

    app_things GET    /things(.:format)                                    app/things#index {:subdomain=>/app/}
               POST   /things(.:format)                                    app/things#create {:subdomain=>/app/}
 new_app_thing GET    /things/new(.:format)                                app/things#new {:subdomain=>/app/}
edit_app_thing GET    /things/:id/edit(.:format)                           app/things#edit {:subdomain=>/app/}
     app_thing GET    /things/:id(.:format)                                app/things#show {:subdomain=>/app/}
               PUT    /things/:id(.:format)                                app/things#update {:subdomain=>/app/}
               DELETE /things/:id(.:format)                                app/things#destroy {:subdomain=>/app/}

Twisting:

curl -IL http://app.testapp.com/things/new
HTTP/1.1 404 Not Found 

From the log (stack trace?):

    Started GET "/things/new" for 127.0.0.1 at 2012-04-24 19:27:02 +0100
Processing by App::ThingsController#new as HTML
  Rendered app/things/_new_form.html.erb (2.0ms)
  Rendered app/things/new.html.erb within layouts/app (2.7ms)
  Rendered layouts/_app_includes.html.erb (11.0ms)
  Rendered app/nav/_things_new.html.erb (1.6ms)
  Rendered app/nav/_menu_wrapper.html.erb (2.1ms)
Completed 500 Internal Server Error in 21ms

ActionController::RoutingError (No route matches {:action=>"edit", :controller=>"app/things", :id=>#<Thing id: nil, title: nil, created_at: nil, updated_at: nil, account_id: nil>}):
  app/views/app/nav/_step_1_title.html.erb:2:in `_app_views_app_nav__step___title_html_erb__3644446743043796555_70280275307960'
  app/views/app/nav/_things_new.html.erb:1:in `_app_views_app_nav__things_new_html_erb__4471631226426153422_70280275315660'
  app/views/app/nav/_menu_wrapper.html.erb:8:in `_app_views_app_nav__menu_wrapper_html_erb___3003322303253991863_70280275346820'
  app/views/layouts/app.html.erb:32:in `_app_views_layouts_app_html_erb__4514085623626236526_70280285513740'


  Rendered /Users/blerg/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.6ms)
+3
source share
4 answers

, /things/new. - (, _nav), edit_app_thing_path .

+6

development.log, "/things/new". , , .

edit_thing_path(@thing) : - #<Thing id: nil... .

+4

.

, , , , . :

Rails

$ bundle exec rails -v
Rails 3.2.2

routes.rb

scope :module => :app, :as => :app, :constraints => { :subdomain => /app/ } do
  resources :things
end

-

$ bundle exec rake routes
    app_things GET    /things(.:format)          app/things#index {:subdomain=>/app/}
               POST   /things(.:format)          app/things#create {:subdomain=>/app/}
 new_app_thing GET    /things/new(.:format)      app/things#new {:subdomain=>/app/}
edit_app_thing GET    /things/:id/edit(.:format) app/things#edit {:subdomain=>/app/}
     app_thing GET    /things/:id(.:format)      app/things#show {:subdomain=>/app/}
               PUT    /things/:id(.:format)      app/things#update {:subdomain=>/app/}
               DELETE /things/:id(.:format)      app/things#destroy {:subdomain=>/app/}

things/new

$ curl -IL http://app.test.dev:3001/things/new
HTTP/1.1 200 OK
...

, , .

+2

:

scope "/app" do
  resources :things
end
0

All Articles