I thought I was getting somewhere with this, but there is clearly
something I am not grasping, or I am driving in the wrong direction.
I am tidying up an application, and rebuilding it under rails 2.
I thought it would be a good move to put my admin functions under an
admin section so that for example, users can be managed in an admin/
users controller.
Now I thought I had got this figured out because I got the routing
working by doing this:
map.connect ‘/main’, :controller=>‘main’
map.connect ‘/main/clear_prompt’,
:controller=>‘main’,
:action=>‘clear_prompt’
map.namespace :admin do |admin|
admin.resources :users
admin.connect ‘/main’, :controller=>‘main’
end
I have a main controller both at the top level and in the admin
namespace. This seems ok with the above routes. User routing works
using admin_user_path etc. ie. I can use User.find in the controller
without any problem.
BUT, I have run into trouble trying to set up tests. These got put
under admin/user as I guess I should have expected. But the test
setup appears to be looking for a table called admin_users. Now I
dont really want to call it that. Am I going to be stuck with
changing the table name, or is there a way of setting up the tests so
that it uses users and not admin_users as the table.
---------- Error message when running unit tests
test_truth(CustomersTest):
ActiveRecord::StatementInvalid: Mysql::Error: Table
‘italk_test.admin_users’ doesn’t exist: DELETE FROM admin_users
Or am I misunderstanding the whole thing?
Thanks for any help
Tonypm