Hi. I have very strange problem with mysql. Project just recently created and it is have several simple controls and views, nothing complex. Problem that rails test could not find Mysql constant. When I run ''rake'' I got following error 42) Error: test_truth(TicketTest): NameError: uninitialized constant Mysql c:/progra~1/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.2/lib/active_support/dependencies.rb:198:in `const_missing'' c:/progra~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/connection_adapters/mysql_adapter.rb:12:in `mysql_connection'' c:/progra~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:120:in `send'' c:/progra~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:120:in `connection_without_query_cache='' c:/progra~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/query_cache.rb:54:in `connection='' c:/progra~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:83:in `retrieve_connection'' c:/progra~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/base.rb:241:in `connection'' c:/progra~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/fixtures.rb:506:in `teardown'' But controllers that use Mysql work perfectly in dev mode (I could save object to DB), so I dont understand why Mysql visible in development mode and could not be found in test. Do I need configure it in some special way?? WinXP, ruby 1.8.2, rails 0.14.2 -- anatol _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Try setting: config.cache_classes = false In production.rb. You will loose a lot of speed, we are not sure about the cause. -- Aníbal Rojas http//www.lacaraoscura.com/ anibalrojas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org On 11/4/05, Anatol Pomozov <anatol.pomozov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi. > > I have very strange problem with mysql. Project just recently created and > it is have several simple controls and views, nothing complex. > > Problem that rails test could not find Mysql constant. When I run ''rake'' I > got following error > 42) Error: > test_truth(TicketTest): > NameError: uninitialized constant Mysql > > c:/progra~1/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.2/lib/active_support/dependencies.rb:198:in > `const_missing'' > > c:/progra~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/connection_adapters/mysql_adapter.rb:12:in > `mysql_connection'' > > c:/progra~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:120:in > `send'' > > c:/progra~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:120:in > `connection_without_query_cache='' > > c:/progra~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/query_cache.rb:54:in > `connection='' > > c:/progra~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:83:in > `retrieve_connection'' > > c:/progra~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/base.rb:241:in > `connection'' > > c:/progra~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/fixtures.rb:506:in > `teardown'' > > But controllers that use Mysql work perfectly in dev mode (I could save > object to DB), so I dont understand why Mysql visible in development mode > and could not be found in test. Do I need configure it in some special way?? > > WinXP, ruby 1.8.2, rails 0.14.2 > > -- > anatol > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
Anatol Pomozov
2005-Nov-04 15:58 UTC
Re: "NameError: uninitialized constant Mysql" in tests
But why I happend. Could you explain a bit more?? On 11/4/05, Aníbal Rojas <anibalrojas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Try setting: > > config.cache_classes = false > > In production.rb. You will loose a lot of speed, we are not sure about > the cause. > > -- > Aníbal Rojas > http//www.lacaraoscura.com/ > anibalrojas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > On 11/4/05, Anatol Pomozov <anatol.pomozov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi. > > > > I have very strange problem with mysql. Project just recently created > and > > it is have several simple controls and views, nothing complex. > > > > Problem that rails test could not find Mysql constant. When I run ''rake'' > I > > got following error > > 42) Error: > > test_truth(TicketTest): > > NameError: uninitialized constant Mysql > > > > c:/progra~1/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.2 > /lib/active_support/dependencies.rb:198:in > > `const_missing'' > > > > c:/progra~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2 > /lib/active_record/connection_adapters/mysql_adapter.rb:12:in > > `mysql_connection'' > > > > c:/progra~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2 > /lib/active_record/connection_adapters/abstract/connection_specification.rb:120:in > > `send'' > > > > c:/progra~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2 > /lib/active_record/connection_adapters/abstract/connection_specification.rb:120:in > > `connection_without_query_cache='' > > > > c:/progra~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2 > /lib/active_record/query_cache.rb:54:in > > `connection='' > > > > c:/progra~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2 > /lib/active_record/connection_adapters/abstract/connection_specification.rb:83:in > > `retrieve_connection'' > > > > c:/progra~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2 > /lib/active_record/base.rb:241:in > > `connection'' > > > > c:/progra~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2 > /lib/active_record/fixtures.rb:506:in > > `teardown'' > > > > But controllers that use Mysql work perfectly in dev mode (I could save > > object to DB), so I dont understand why Mysql visible in development > mode > > and could not be found in test. Do I need configure it in some special > way?? > > > > WinXP, ruby 1.8.2, rails 0.14.2 > > > > -- > > anatol > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- anatol _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
I installed the v2.7 mysql.so binary for Windows to fix a timeout problem and now I am getting "uninitialized constant Mysql". I already have in production.rb config.cache_classes = false Are there any other ways to fix this?
Well, upgrading from 4.1 to 5.0 and copying the 5.0 libmysql.dll to c:\windows\system32 seems to have fixed it. Charles Leeds wrote:> I installed the v2.7 mysql.so binary for Windows to fix a timeout > problem and now I am getting "uninitialized constant Mysql". > > I already have in production.rb > > config.cache_classes = false > > Are there any other ways to fix this? > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
Yeah!!! I wonder why... Charles Leeds wrote:> Well, upgrading from 4.1 to 5.0 and copying the 5.0 libmysql.dll to > c:\windows\system32 seems to have fixed it.-- 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 -~----------~----~----~----~------~----~------~--~---