Hi, I thought I''d use the weekend to get into RoR but got stuck quite early. I''m using RoR with MySQL on my gentoo laptop and am following the depot application from "Agile Web Development with Ruby on Rails". My MySQL is running and has got the products table in it. The user is called mysql and does not need a password. The database.yml is adapted so that it uses that user and also has the right location for the socket (I also tried with an empty user): development: adapter: mysql database: depot_development username: mysql password: socket: /var/run/mysqld/mysqld.sock Here is the output of running the generator script: wei-fieg@nono depot $ ruby script/generate scaffold Product Admin exists app/controllers/ exists app/helpers/ create app/views/admin exists test/functional/ dependency model exists app/models/ exists test/unit/ exists test/fixtures/ create app/models/product.rb create test/unit/product_test.rb create test/fixtures/products.yml uninitialized constant Mysql and here is the list of my installed gems: wei-fieg@nono depot $ gem list --local *** LOCAL GEMS *** actionmailer (1.1.3, 1.0.1) Service layer for easy email delivery and testing. actionpack (1.11.0, 1.9.1) Web-flow and rendering framework putting the VC in MVC. actionwebservice (0.9.3, 0.8.1) Web service support for Action Pack. activerecord (1.13.0, 1.11.1) Implements the ActiveRecord pattern for ORM. activesupport (1.2.3, 1.1.1) Support and utility classes used by the Rails framework. mysql (2.7) MySQL/Ruby provides the same functions for Ruby programs that the MySQL C API provides for C programs. rails (0.14.3, 0.13.1) Web-application framework with template engine, control-flow layer, and ORM. rake (0.6.2, 0.5.3) Ruby based make-like utility. sources (0.0.1) This package provides download sources for remote gem installation Can anyone point me to some solution? Thanks -- Dominik -- Posted via http://www.ruby-forum.com/.
Strange that the error has a captial ''M'' _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Peter Michaux wrote:> Strange that the error has a captial ''M''No, that looks about right - there''s a line like: include Mysql that''s failed somewhere. -- Alex
alex wrote:> Peter Michaux wrote: >> Strange that the error has a captial ''M'' > > No, that looks about right - there''s a line like: > > include Mysql > > that''s failed somewhere.I have found a workaround: simply putting the following line into the file activerecord-1.13.0/lib/active_record/connection_adapters/mysql_adapter.rb solves the problem: require ''active_record/vendor/mysql.rb'' But this is only a hack... I would like to know what''s wrong with my setup. I''ll post it if I find it out. -- Posted via http://www.ruby-forum.com/.
this is pure genius, as, so far no-one has been able to answer my exact question, but in one sentence all my problems have vanished, thank you so much, after posting/searching forums for the last 3 weeks(i gathered from the answers i got that loads of ruby users have the same problem), you have solved my problem, i had the exact problem from word go, my article at lighttpd http://forum.lighttpd.net/topic/575#new> I have found a workaround: simply putting the following line into the > file > activerecord-1.13.0/lib/active_record/connection_adapters/mysql_adapter.rb > solves the problem: > > require ''active_record/vendor/mysql.rb''i agree with you, i would also like to know what is wrong with my Ruby setup as there was a missing connection between ruby and mysql. thanks again -- Posted via http://www.ruby-forum.com/.
anyone know why this works, or why it was a problem in the first place> I have found a workaround: simply putting the following line into the > file > activerecord-1.13.0/lib/active_record/connection_adapters/mysql_adapter.rb > solves the problem: > > require ''active_record/vendor/mysql.rb'' > > But this is only a hack... I would like to know what''s wrong with my > setup. I''ll post it if I find it out.-- Posted via http://www.ruby-forum.com/.
Jared wrote:> Dominik Wei-Fieg wrote: >> alex wrote: >>> Peter Michaux wrote: >>>> Strange that the error has a captial ''M'' >>> >>> No, that looks about right - there''s a line like: >>> >>> include Mysql >>> >>> that''s failed somewhere. >> >> I have found a workaround: simply putting the following line into the >> file >> activerecord-1.13.0/lib/active_record/connection_adapters/mysql_adapter.rb >> solves the problem: >> >> require ''active_record/vendor/mysql.rb'' >> >> But this is only a hack... I would like to know what''s wrong with my >> setup. I''ll post it if I find it out. > > > Fair warning. I originally had the ''uninitialized constant Mysql'' > problem. I tried the solution here, which has worked for some people. > For me, however, it caused another error, the "lost connection to mysql > server during query" error which is discussed here: > http://wiki.rubyonrails.org/rails/pages/Mysql+Connection+Problems > I was able to fix both problems by removing the line ''require > ''active_record/vendor/mysql.rb'' and properly installing the Mysql gem.doing the require ''active_record/vendor/mysql.rb'' doesn''t use the mysql gem. you get the ver, it caused another error, the "lost connection to mysql> server during query" error which is discussed here: > http://wiki.rubyonrails.org/rails/pages/Mysql+Connection+Problems > I was able to fix both problems by removing the line ''require > ''active_record/vendor/mysql.rb'' and properly installing the Mysql gem.doing the require ''active_record/vendor/mysql.rb'' doesn''t use the mysql gem. you get the ''uninitialized constant Mysql'' message because the load of the mysql gem failed, but didnt'' raise an exception. if it had the above require would have been called. the problem is with mysql_config. the fix is below http://www.mail-archive.com/dbi-users@perl.org/msg27851.html unless there is a way to pass in ldflags to a gem install(i didn''t find a way) you will need to edit mysql_config directly. do an uninstall of the mysql gem and then reinstall and remove that require. i am using mysql-5.0.22 hope this helps. -- Posted via http://www.ruby-forum.com/.
Hi all This is an issue with mysql 5. Install mysql 4 then: #gem uninstall mysql #gem install mysql -- --with-mysql-dir=/usr/local/mysql Hope this helps Graeme -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---