Rails Scaffold, ActiveRecord, and table names 5
Looks like the Rails scaffolding doesn’t like it when your model uses a different table name from the default mapping it expects(like when accessing a legacy database model).
So if you have a model like so:
class Thing < ActiveRecord::Base
set_table_name "some_thing"
end
Then ActiveRecord will be expecting a table called “some_thing”, however the scaffolding generator is expecting the default, which is going to be “things”(or something like that since I can’t be bothered actually generating a model called Thing).
When running your generator you’re going to end up with an error like:
error Before updating scaffolding from new DB schema, try creating a table for your model (Thing)
Annoying as this is, you can work around it by temporarily creating the table required by the generator. Then go ahead and drop it after the generator works.
create table things ();
I’m not sure what longer term effects this causes, and if there is a better way then let me know.
Trackbacks
Use the following link to trackback from your own site:
http://blogs.divisibleprime.com/ronin/articles/trackback/870
-
Casino 1241270293
-
superdrupermegapuper54321
-
Very usefull. Thanks! payday+loans+online+without+fax
-
Very usefull. Thanks! 24hr+sameday+cash+loan+without+paperwork+or+fax
-
Very usefull. Thanks! emergency+cash+loans
-
Very usefull. Thanks! instant online payday loan
-
Very usefull. Thanks! not a payday loans with bad credit
-
Very usefull. Thanks! not a payday loans with bad credit
-
Very usefull. Thanks! missouri regulation of pay day or title loans

by the way, koz has said they’ve fixed this in 2.0. They’ve redone the scaffolding totally apparently :)
Cool
In the meantime you could try http://activescaffold.com/
In the meantime you could try http://activescaffold.com/
This is what I’m looking for.