Noob question regarding site and table naming structure

I’m a newbie at Rails and Ruby so please bear with me:

I’m trying to build a simple application that has an administration
system that manages organizations and products. I want the model/views/
controllers for ‘organizations’ and ‘products’ to be within the
‘admin’ part of the site, so I created a controller for admin first:

generate controller admin

then I created scaffolding like thus:

generate scaffold admin/organization
generate scaffold admin/product

everything seems fine so far, the tables created through the migration
were admin_organizations and admin_products which is fine, until I try
to access the index view for either organizations or products, at
which point I get the error:

Table ‘wyforg_development.products’ doesn’t exist: SELECT * FROM
products

which makes sense since the table is called ‘admin_products’ not
‘products’. I assume the way to address this is not to rename the
tables ‘products’ and ‘organizations’, dropping the ‘admin_’ prefix,
but by some other method of overriding the default configuration of
the scaffolding, but I can’t figure out where to do this and how.
Thanks for any help.

~Ben

It took me most of the day, but I think I understand a little bit
better now. If anyone reading this finds fault with this approach,
please comment, I’m still struggling to understand why things work or
don’t.

I modified the routes.rb file to replace this:

map.resources :organizations

with this:

map.namespace :admin do |admin|
admin.resources :organizations
end

But it would still throw a database error. So I had to add this to the
model:

set_table_name “admin_organizations”

I’m not sure whether this is the correct way to do things or not but
it seems to work after modifying various views.