I''m trying to work my way through Version 2005-6-7 of "Agile Web Development with Rails" (a PDF I grabbed a while back). After a bunch of prep work, I issued the command ruby script/generate scaffold Product Admin dependency model exists app/models/ exists test/unit/ ... create app/views/admin/edit.rhtml error Before updating scaffolding from new DB schema, try creating a table for your model (Product) This looks bad. Also, after killing and restarting WEBrick, the page I got for http://localhost:3000/admin said: Routing Error Recognition failed for "/admin" A comment on the web page http://books.pragprog.com/titles/rails/errata/add?pdf_page=52 hints that there is a solution, but does not give one. Help? -r -- email: rdm-go8te9J4rpw@public.gmane.org; phone: +1 650-873-7841 http://www.cfcl.com - Canta Forda Computer Laboratory http://www.cfcl.com/Meta - The FreeBSD Browser, Meta Project, etc.
Did you create your "products" table? If so, verify your config/database.yml setting, and make sure you can access your database with the user name and password specified in the "development" section. If you followed the book and are using MySQL. The user you created has no password and should be able to connet to and access the database with the following, mysql -u dave depot_development You can issue a simple sql such as "select * from products;" to check if the table has been created in the sql prompt. Once the database issue is resolved, you should re-run scaffold since it didn''t complete the first time. Barry ----- Original Message ----- From: "Rich Morin" <rdm-go8te9J4rpw-XMD5yJDbdMReXY1tMh2IBg@public.gmane.org> Newsgroups: gmane.comp.lang.ruby.rails Sent: Sunday, September 11, 2005 1:45 PM Subject: need help getting started with "depot"> I''m trying to work my way through Version 2005-6-7 of "Agile Web > Development with Rails" (a PDF I grabbed a while back). After > a bunch of prep work, I issued the command > > ruby script/generate scaffold Product Admin > dependency model > exists app/models/ > exists test/unit/ > ... > create app/views/admin/edit.rhtml > error Before updating scaffolding from new DB schema, > try creating a table for your model (Product) > > This looks bad. Also, after killing and restarting WEBrick, the > page I got for http://localhost:3000/admin said: > > Routing Error > > Recognition failed for "/admin" > > A comment on the web page > > http://books.pragprog.com/titles/rails/errata/add?pdf_page=52 > > hints that there is a solution, but does not give one. > > Help? > > -r > -- > email: rdm-go8te9J4rpw-XMD5yJDbdMReXY1tMh2IBg@public.gmane.org; phone: +1 650-873-7841 > http://www.cfcl.com - Canta Forda Computer Laboratory > http://www.cfcl.com/Meta - The FreeBSD Browser, Meta Project, etc.
Rich, Did you set up your database and create the tables for Product and Admin? Otherwise, Rails doesn't know what fields you want in your view (.rhtml files). If you did create the proper tables, make sure your config/database.yml file contains the right login info for your database server. I'm not sure what else could be going on. In any case, it either could not connect to your db server or once connected cannot find what it wants. If using mysql, make sure you did "gem install mysql" or "gem install postgres-pr" for postgresql to get the proper database driver. Also, try connecting to your db manually with some utility to make sure your db user can read the database/tables. Good luck! Jacob On 9/11/05, Rich Morin <rdm@cfcl.com> wrote:> I'm trying to work my way through Version 2005-6-7 of "Agile Web > Development with Rails" (a PDF I grabbed a while back). After > a bunch of prep work, I issued the command > > ruby script/generate scaffold Product Admin > dependency model > exists app/models/ > exists test/unit/ > ... > create app/views/admin/edit.rhtml > error Before updating scaffolding from new DB schema, > try creating a table for your model (Product) > > This looks bad. Also, after killing and restarting WEBrick, the > page I got for http://localhost:3000/admin said: > > Routing Error > > Recognition failed for "/admin" > > A comment on the web page > > http://books.pragprog.com/titles/rails/errata/add?pdf_page=52 > > hints that there is a solution, but does not give one. > > Help? > > -r > -- > email: rdm@cfcl.com; phone: +1 650-873-7841 > http://www.cfcl.com - Canta Forda Computer Laboratory > http://www.cfcl.com/Meta - The FreeBSD Browser, Meta Project, etc. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Perhaps I should be a bit more specific. First, some background: * I''m running Mac OS X 10.4.2, which is reputed to have a botched version of Ruby. * I''ve installed MySQL successfully and I appear to have created the "products" table: mysql> show columns from products; +-------------+---------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+---------------+------+-----+---------+----------------+ | id | int(11) | | PRI | NULL | auto_increment | | title | varchar(100) | | | | | | description | text | | | | | | image_url | varchar(200) | | | | | | price | decimal(10,2) | | | 0.00 | | +-------------+---------------+------+-----+---------+----------------+ 5 rows in set (0.00 sec) * I''ve installed Ruby, RubyGems, and Rails successfully, at least to the point that they run the "demo" OK. * As advised by assorted sources, I''ve tried assorted commands, in assorted orders, including: curl -O rufy.com/fix-ruby-tiger.sh; sh fix-ruby-tiger.sh gem install mysql -- --with-mysql-dir=/usr/local/mysql gem install rails --include-dependencies I suspect that I''ve managed to trash my installation in some manner, so I may need to remove some stuff, then add things back in the right order. Unfortunately, I don''t know what to remove, nor what the right order is. In short, I need a recipe. -r -- email: rdm-go8te9J4rpw@public.gmane.org; phone: +1 650-873-7841 http://www.cfcl.com - Canta Forda Computer Laboratory http://www.cfcl.com/Meta - The FreeBSD Browser, Meta Project, etc.
Hmmmm... not sure what is wrong. Try moving your "depot" directory somewhere else and starting over. Make sure your database connection settings are accurate. Then try to connect to your mysql database manually, using the login info your wrote down in your database.yml file (just to check permissions). I don't run OS X so can't help you with fixing the botched Ruby installation, hopefully an OS X Ruby geek can help you. Jacob On 9/11/05, Rich Morin <rdm@cfcl.com> wrote:> Perhaps I should be a bit more specific. First, some background: > > * I'm running Mac OS X 10.4.2, which is reputed to have a botched > version of Ruby. > > * I've installed MySQL successfully and I appear to have created the > "products" table: > > mysql> show columns from products; > +-------------+---------------+------+-----+---------+----------------+ > | Field | Type | Null | Key | Default | Extra | > +-------------+---------------+------+-----+---------+----------------+ > | id | int(11) | | PRI | NULL | auto_increment | > | title | varchar(100) | | | | | > | description | text | | | | | > | image_url | varchar(200) | | | | | > | price | decimal(10,2) | | | 0.00 | | > +-------------+---------------+------+-----+---------+----------------+ > 5 rows in set (0.00 sec) > > * I've installed Ruby, RubyGems, and Rails successfully, at least > to the point that they run the "demo" OK. > > * As advised by assorted sources, I've tried assorted commands, in > assorted orders, including: > > curl -O rufy.com/fix-ruby-tiger.sh; sh fix-ruby-tiger.sh > gem install mysql -- --with-mysql-dir=/usr/local/mysql > gem install rails --include-dependencies > > > I suspect that I've managed to trash my installation in some manner, so > I may need to remove some stuff, then add things back in the right order. > Unfortunately, I don't know what to remove, nor what the right order is. > In short, I need a recipe. > > -r > -- > email: rdm@cfcl.com; phone: +1 650-873-7841 > http://www.cfcl.com - Canta Forda Computer Laboratory > http://www.cfcl.com/Meta - The FreeBSD Browser, Meta Project, etc. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
This page http://www.juju.org/articles/2005/08/06/ruby-on-rails-mysql-and-osx-tiger-woes solved the problem. -r -- email: rdm-go8te9J4rpw@public.gmane.org; phone: +1 650-873-7841 http://www.cfcl.com - Canta Forda Computer Laboratory http://www.cfcl.com/Meta - The FreeBSD Browser, Meta Project, etc.