resources_controller
resources_controller copied to clipboard
Problem with resources controller on destroy
Rails 2.3.2.
I created a new project. Installed the resources_controller plugin. Generated scaffold for a model:
ruby script\generate scoffold projects title:string description:text resources:text created_by:integer.
Edited projects_controller to remove rails generated scaffolding, and make it:
class ProjectsController < ApplicationController resources_controller_for :projects end
Then ran rake test
Functional test (generated by scaffold) fails on should_destroy.
Redirect should be to
test_should_destroy_project(ProjectsControllerTest): Expected response to be a redirect to http://test.host/projects but was a redirect to http://test.host/projects.%23%3Cproject:0x54c11fc%3E.
It looks like a bug: .%23%3Cproject:0x54c11fc%3E is an object where an empty string was expected. But maybe I missed something in the configuration.
Routes file looks normal enough:
(in D:/InstantRails-2.0-win/rails_apps/test-rc)
projects GET /projects(.:format) {:controller=>"projects", :action=>"index"}
POST /projects(.:format) {:controller=>"projects", :action=>"create"}
new_project GET /projects/new(.:format) {:controller=>"projects", :action=>"new"}
edit_project GET /projects/:id/edit(.:format) {:controller=>"projects", :action=>"edit"}
project GET /projects/:id(.:format) {:controller=>"projects", :action=>"show"}
PUT /projects/:id(.:format) {:controller=>"projects", :action=>"update"}
DELETE /projects/:id(.:format) {:controller=>"projects", :action=>"destroy"}
/:controller/:action/:id
/:controller/:action/:id(.:format)