Hi, I know this has come up in the recent past, but I haven''t found an answer. It seems to be a common problem. I''ve just installed MySQL 4.1.11 and rails 0.12.1.1264 (as well as all the dependencies) on Mac OS X Tiger. I''ve created a simple ''user'' table, and generated a controller and model for it. I then proceeded to add: model :User scaffold :User to my user_controller.rb file. I then fired up webrick, navigated to http://127.0.0.1:3000/user and received the error attached. In a nutshell, it''s: undefined method `fetch_fields'' for nil:NilClass . I think this is a common problem, so I''m hoping for an easy solution. I''ve been using Rails on my TextDrive account and love it, but it''d be nice to have it working locally too. Thanks, Ben _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 16.5.2005, at 15:58, Ben Myles wrote:> Hi, > > I know this has come up in the recent past, but I haven''t found an > answer. It seems to be a common problem. > > I''ve just installed MySQL 4.1.11 and rails 0.12.1.1264 (as well as all > the dependencies) on Mac OS X Tiger. I''ve created a simple ''user'' > table, and generated a controller and model for it.The table name needs to be in plural: users. Otherwise you need to specify the table name explicitly in your AR model class. //jarkko -- Jarkko Laine http://jlaine.net http://odesign.fi _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Sorry - that was a typo - the table is ''users'' and has the ''id'' auto-increment, primary key field. Ben On 5/16/05, Jarkko Laine <jarkko-k1O+Gnc6WpmsTnJN9+BGXg@public.gmane.org> wrote:> The table name needs to be in plural: users. Otherwise you need to > specify the table name explicitly in your AR model class.
Just to follow up - I''ve no idea why MySQL wouldn''t work, but when I installed sqlite3, duplicated my schema and set my app up to use the sqlite3 db instead, everything worked perfectly. Cheers, Ben On 5/16/05, Ben Myles <ben.myles-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Sorry - that was a typo - the table is ''users'' and has the ''id'' > auto-increment, primary key field. > > Ben > > On 5/16/05, Jarkko Laine <jarkko-k1O+Gnc6WpmsTnJN9+BGXg@public.gmane.org> wrote: > > > The table name needs to be in plural: users. Otherwise you need to > > specify the table name explicitly in your AR model class. >