No, this is what's happening:
when i typed for the first time /admin/categories, it rendered me the
empty list of categories. I clicked the New link, rendered the add
form, submit the form rendered the new category, click the Return link
which  is /admin/categories, performed show action. WHY?

If i delete the entry in my database, /admin/categories performs index
action like it should. WHY²?

Here is my log:


Started GET "/admin/categories" for 127.0.0.1 at 2011-09-14 23:16:04
+0200
  Processing by Admin::CategoriesController#index as HTML
   [1m [36mCategory Load (0.5ms) [0m   [1mSELECT "categories".* FROM
"categories"  [0m
Rendered admin/categories/index.html.erb within layouts/application
(19.3ms)
Completed 200 OK in 120ms (Views: 117.5ms | ActiveRecord: 0.5ms)


Started GET "/assets/application.css?body=1" for 127.0.0.1 at
2011-09-14 23:16:05 +0200
Served asset /application.css - 304 Not Modified (0ms)


Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2011-09-14
23:16:05 +0200
Served asset /jquery.js - 304 Not Modified (6ms)


Started GET "/assets/categories.js?body=1" for 127.0.0.1 at 2011-09-14
23:16:05 +0200
Served asset /categories.js - 304 Not Modified (2ms)


Started GET "/assets/admin/categories.js?body=1" for 127.0.0.1 at
2011-09-14 23:16:05 +0200
Served asset /admin/categories.js - 304 Not Modified (2ms)


Started GET "/assets/application.js?body=1" for 127.0.0.1 at
2011-09-14 23:16:05 +0200
Served asset /application.js - 304 Not Modified (0ms)


Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2011-09-14
23:16:05 +0200
Served asset /jquery_ujs.js - 304 Not Modified (4ms)


Started GET "/admin/categories/new" for 127.0.0.1 at 2011-09-14
23:16:06 +0200
  Processing by Admin::CategoriesController#new as HTML
Rendered admin/categories/_form.html.erb (24.0ms)
Rendered admin/categories/new.html.erb within layouts/application
(38.3ms)
Completed 200 OK in 48ms (Views: 44.7ms | ActiveRecord: 2.0ms)


Started GET "/assets/application.css?body=1" for 127.0.0.1 at
2011-09-14 23:16:06 +0200
Served asset /application.css - 304 Not Modified (0ms)


Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2011-09-14
23:16:06 +0200
Served asset /jquery_ujs.js - 304 Not Modified (0ms)


Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2011-09-14
23:16:06 +0200
Served asset /jquery.js - 304 Not Modified (0ms)


Started GET "/assets/admin/categories.js?body=1" for 127.0.0.1 at
2011-09-14 23:16:06 +0200
Served asset /admin/categories.js - 304 Not Modified (0ms)


Started GET "/assets/categories.js?body=1" for 127.0.0.1 at 2011-09-14
23:16:06 +0200
Served asset /categories.js - 304 Not Modified (0ms)


Started GET "/assets/application.js?body=1" for 127.0.0.1 at
2011-09-14 23:16:06 +0200
Served asset /application.js - 304 Not Modified (0ms)


Started POST "/admin/categories" for 127.0.0.1 at 2011-09-14 23:16:16
+0200
  Processing by Admin::CategoriesController#create as HTML
  Parameters: {"utf8"=>"✓",
"authenticity_token"=>"PVlLpCPYEhLre3tsFlYRQdVnbbySI2Gw/YSCEuzjnWo=",
"category"=>{"name"=>"vaze", "branch"=>"Project"}, "commit"=>"Create
Category"}
   [1m [35m (0.3ms) [0m  BEGIN
   [1m [36mSQL (24.0ms) [0m   [1mINSERT INTO "categories" ("branch",
"created_at", "name", "updated_at") VALUES ($1, $2, $3, $4) RETURNING
"id" [0m  [["branch", "Project"], ["created_at", Wed, 14 Sep 2011
21:16:16 UTC +00:00], ["name", "vaze"], ["updated_at", Wed, 14 Sep
2011 21:16:16 UTC +00:00]]
   [1m [35m (12.0ms) [0m  COMMIT
Redirected to http://127.0.0.1:3000/admin/categories/7
Completed 302 Found in 51ms


Started GET "/admin/categories/7" for 127.0.0.1 at 2011-09-14 23:16:16
+0200
  Processing by Admin::CategoriesController#show as HTML
  Parameters: {"id"=>"7"}
   [1m [36mCategory Load (0.8ms) [0m   [1mSELECT "categories".* FROM
"categories" WHERE "categories"."id" = $1 LIMIT 1 [0m  [["id", "7"]]
Rendered admin/categories/show.html.erb within layouts/application
(7.1ms)
Completed 200 OK in 25ms (Views: 16.6ms | ActiveRecord: 4.1ms)


Started GET "/assets/application.css?body=1" for 127.0.0.1 at
2011-09-14 23:16:16 +0200
Served asset /application.css - 304 Not Modified (0ms)


Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2011-09-14
23:16:16 +0200
Served asset /jquery.js - 304 Not Modified (0ms)


Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2011-09-14
23:16:16 +0200
Served asset /jquery_ujs.js - 304 Not Modified (0ms)


Started GET "/assets/categories.js?body=1" for 127.0.0.1 at 2011-09-14
23:16:16 +0200
Served asset /categories.js - 304 Not Modified (0ms)


Started GET "/assets/admin/categories.js?body=1" for 127.0.0.1 at
2011-09-14 23:16:16 +0200
Served asset /admin/categories.js - 304 Not Modified (0ms)


Started GET "/assets/application.js?body=1" for 127.0.0.1 at
2011-09-14 23:16:16 +0200
Served asset /application.js - 304 Not Modified (0ms)


Started GET "/admin/categories" for 127.0.0.1 at 2011-09-14 23:16:18
+0200
  Processing by Admin::CategoriesController#index as HTML
   [1m [35mCategory Load (0.3ms) [0m  SELECT "categories".* FROM
"categories"
Rendered admin/categories/index.html.erb within layouts/application
(39.4ms)
Completed 500 Internal Server Error in 52ms

ActionView::Template::Error (No route matches
{:action=>"show", :controller=>"admin/categories"}):
    13:   <tr>
    14:     <td><%= category.name %></td>
    15:     <td><%= category.branch %></td>
    16:     <td><%= link_to 'Show', admin_category_path(@category) %></
td>
    17:     <td><%= link_to 'Edit',
edit_admin_category_path(@category) %></td>
    18:     <td><%= link_to 'Destroy', admin_category_path(@category),
confirm: 'Are you sure?', method: :delete %></td>
    19:   </tr>
  app/views/admin/categories/index.html.erb:16:in `block in
_app_views_admin_categories_index_html_erb___936809880_79782210'
  app/views/admin/categories/index.html.erb:12:in `each'
  app/views/admin/categories/index.html.erb:12:in
`_app_views_admin_categories_index_html_erb___936809880_79782210'
  app/controllers/admin/categories_controller.rb:7:in `index'

Rendered /usr/lib/ruby/gems/1.9.1/gems/actionpack-3.1.0/lib/
action_dispatch/middleware/templates/rescues/routing_error.erb within
rescues/layout (0.8ms)

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/rubyonrails-talk?hl=en.

Reply via email to