Hello all, I am new to RoR and am working my way through Timothy Fisher''s Ruby On Rails Bible. I''m stuck on page 81. I have followed the steps leading to this page, i.e. cd rails_projects rails contactlist <creates all the directories> ruby script/server webrick <shows the Welcome Aboard page> open a cmd window and run mysql: create database contactlist_development; use contactlist_development; create table contacts (id int not null auto_increment, ...etc.); show tables; <shows table contacts> describe contacts; <shows table structure> <switch back to other window> ruby script/generate model Contact <shows directories created> <look at app/models/contact.rb, which shows:> class Contact < ActiveRecord:: Base end ruby script/console Loading development environment <this works fine> my_contact = Contact.new <here''s the problem: instead of showing me the attributes of the instance, I get the message: ActiveRecord::StatementInvalid: Could not find table ''contacts'' from c:\program files\BitNami RubyStack/ruby/lib/ruby/gems... etc.... and many other error messages too. Ohhh! I just noticed that another of the error messages indicates that it is looking for a sqlite3_adapter.rb:29. Hmmm. How do I tell it that I''m using mySQL not sqlite? For most or all of you, this is probably a trivial question, but for me it is a show stopper. I''m very excited by the language and the framework and the book, but at the moment I''m slamming my forehead on this wall. Please help. TIA, Arthur --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi -- On Sun, 27 Sep 2009, Arthur Fuller wrote:> Ohhh! I just noticed that another of the error messages indicates that it is looking for a > sqlite3_adapter.rb:29. Hmmm. How do I tell it that I''m using mySQL not sqlite?When you create the app, you can do: rails myapp --database=mysql If you''ve already created the app, do the above on a second app, then look at config/database.yml and you''ll see the difference in configuration (which you can then adapt for your original app by editing its database.yml). David -- David A. Black, Director Ruby Power and Light, LLC (http://www.rubypal.com) Ruby/Rails training, consulting, mentoring, code review Book: The Well-Grounded Rubyist (http://www.manning.com/black2)
Also, after creating the app with the appropriate database selected, you will want to confirm the settings in the db configuration file "application/config/database.yml". Specifically check the values for "database", "username", and "password" that are associated with all 3 modes (development, test, production). By the way, "rails --help" will give you a list of all command line options. See also: http://guides.rubyonrails.org/ On Sep 27, 8:13 am, "David A. Black" <dbl...-0o/XNnkTkwhBDgjK7y7TUQ@public.gmane.org> wrote:> Hi -- > > On Sun, 27 Sep 2009, Arthur Fuller wrote: > > Ohhh! I just noticed that another of the error messages indicates that it is looking for a > > sqlite3_adapter.rb:29. Hmmm. How do I tell it that I''m using mySQL not sqlite? > > When you create the app, you can do: > > rails myapp --database=mysql > > If you''ve already created the app, do the above on a second app, then > look at config/database.yml and you''ll see the difference in > configuration (which you can then adapt for your original app by > editing its database.yml). > > David > > -- > David A. Black, Director > Ruby Power and Light, LLC (http://www.rubypal.com) > Ruby/Rails training, consulting, mentoring, code review > Book: The Well-Grounded Rubyist (http://www.manning.com/black2)
Here''s a helpful resource: http://guides.rubyonrails.org/getting_started.html search for ''mysql'' and you''ll find an example configuration. On Sep 27, 6:52 am, Rick <richard.t.ll...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Also, after creating the app with the appropriate database selected, > you will want to confirm the settings in the db configuration file > "application/config/database.yml". Specifically check the values for > "database", "username", and "password" that are associated with all 3 > modes (development, test, production). > > By the way, "rails --help" will give you a list of all command line > options. > > See also:http://guides.rubyonrails.org/ > > On Sep 27, 8:13 am, "David A. Black" <dbl...-0o/XNnkTkwhBDgjK7y7TUQ@public.gmane.org> wrote: > > > > > Hi -- > > > On Sun, 27 Sep 2009, Arthur Fuller wrote: > > > Ohhh! I just noticed that another of the error messages indicates that it is looking for a > > > sqlite3_adapter.rb:29. Hmmm. How do I tell it that I''m using mySQL not sqlite? > > > When you create the app, you can do: > > > rails myapp --database=mysql > > > If you''ve already created the app, do the above on a second app, then > > look at config/database.yml and you''ll see the difference in > > configuration (which you can then adapt for your original app by > > editing its database.yml). > > > David > > > -- > > David A. Black, Director > > Ruby Power and Light, LLC (http://www.rubypal.com) > > Ruby/Rails training, consulting, mentoring, code review > > Book: The Well-Grounded Rubyist (http://www.manning.com/black2)