sachafournier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Aug-31 18:39 UTC
Problem scaffolding using "namespace"
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
sachafournier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Aug-31 18:44 UTC
Re: Problem scaffolding using "namespace"
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.newns = 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, "sachafourn...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <sachafourn...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
sachafournier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Aug-31 19:16 UTC
Re: Problem scaffolding using "namespace"
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, "sachafourn...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <sachafourn...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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, "sachafourn...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" > > <sachafourn...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > 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--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---