# Problem scaffolding using "namespace"

**URL:** <https://www.ruby-forum.com/t/problem-scaffolding-using-namespace/113503>\
**Category:** Rails\
**Created:** [August 31, 2007, 8:40pm UTC](https://www.ruby-forum.com/t/problem-scaffolding-using-namespace/113503 "2007-08-31T20:40:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 31, 2007, 8:40pm UTC](https://www.ruby-forum.com/t/problem-scaffolding-using-namespace/113503/1 "2007-08-31T20:40:28Z")

</div>

Hello,

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.

Any ideas ?

Regards,

Sacha

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 31, 2007, 8:45pm UTC](https://www.ruby-forum.com/t/problem-scaffolding-using-namespace/113503/2 "2007-08-31T20:45:28Z")

</div>

Hello,

Here an other strange issue probably related:

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’

```
    from (irb):1:in `new'

    from (irb):1

```

On Aug 31, 2:39 pm, “removed\_email\_address@domain.invalid”

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 31, 2007, 9:16pm UTC](https://www.ruby-forum.com/t/problem-scaffolding-using-namespace/113503/3 "2007-08-31T21:16:32Z")

</div>

Hi,

Adding "set\_table\_name “namespace\_people” in my model fix the problem  
I get in the console. But scaffolding is still a issue.

Thanks for any idea.

On Aug 31, 2:44 pm, “removed\_email\_address@domain.invalid”
