I asked this question before, but didn’t get any response. I hope
someone can give me some clue now.
Here’s the background, I upgraded to rails 1.1 and suddenly I was
getting strange failures in my functional tests. I traced the problem
to dynamic scaffolding. I had overwritten all of scaffold’s methods
in my controller (all but show and destroy). Destroy no longer
deleted the given item, and (more importantly) the functional tests
called scaffold’s version of create, rather than mine (though when
run in the server, the correct version was called).
I created a duplicate of my application, and used ScaffoldGenerator
on the duplicate. I then copied the show.rhtml and the two undefined
methods (show and destroy) into my application. After commenting out
dynamic scaffolding, everything works perfectly, no failures in the
tests, etc). So there’s clearly some difference between dynamic
scaffolding and the code generated by ScaffoldGenerator.
Is this a bug in dynamic scaffold? Does anyone know anything about this?
When testing dynamic scaffold destroy method, I needed the following:
assert_redirected_to :action => :list
But the ScaffoldGenerator method required the following:
assert_redirected_to :action => "list"