When executing "ruby script/generate model Namespace::Person" the
script create (as expected) "./models/namespace/person.rb". Also a
migration file is created.
When executing "ruby script/generate controller Namespace::Person" the
script create (as expected) "./controllers/namespace/person.rb".
But when I execute "ruby script/generate scaffold Namespace::Person
Namespace::Person" the script create "./models/person.rb" and got an
error "Before updating scaffolding from new DB schema, try creating a
table for your model (Namespace::Person)". My table exist in the
database. I created it using the migration file created from the first
script call. Also the controller is not created.
When executing "ruby script/generate model Namespace::Person" the
script create (as expected) "./models/namespace/person.rb". Also a
migration file is created. The migration file create a table named
"namespace_people".
I I run the console and try to create a new instance of
"Namespace::Person" I get an exception:
ns = Namespace::Person.new
ns = Namespace::Person.new
ActiveRecord::StatementInvalid: Mysql::Error: #42S02Table
'testdocument_development.people' doesn't exist: SHOW FIELDS FROM
people
from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/connection_adapters/abstract_adapter.rb:128:in `log'
from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/connection_adapters/mysql_adapter.rb:243:in `execute'
from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/connection_adapters/mysql_adapter.rb:348:in `columns'
from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/base.rb:763:in `columns'
from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/base.rb:2060:in
`attributes_from_column_definition_without_lock'
from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/locking/optimistic.rb:45:in
`attributes_from_column_definition'
from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/base.rb:1502:in `initialize_without_callbacks'
from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/callbacks.rb:225:in `initialize'