hi there! unfortunately, we are repeatedly having problems with uninitialized constants in our rails app (v1.1.6), which is running on a mongrel cluster behind apache''s mod_proxy_balancer. ---- snip ---- NameError (uninitialized constant Base): [...] /app/models/image.rb:90:in `subclasses'' /app/models/image.rb:98:in `subclass?'' /app/models/image.rb:261:in `count'' /app/controllers/image_controller.rb:95:in `list'' ---- snip ---- "Base" is actually "Image::Base", defined in lib/image/base.rb: class Image::Base. immediately after a mongrel_cluster restart it''s working for a few requests, though. (approx. 4 requests, resulting from 4 mongrel servers being run?) the strange thing just is that everything works fine when run from script/console ... except when commenting out the "require ''image/base''" from config/environment.rb! -- how come? code details are as follows: app/controllers/image_controller.rb: class ImageController < ApplicationController: ---- snip ---- def list # Image.count is where all evil originates @images = ::Paginator.new(Image.count, 10) { |offset, per_page| Image.find(:all, :limit => per_page, :offset => offset) }.page(params[:page]) end ---- snip ---- app/models/image.rb: class Image < Entity (Entity < ActiveRecord::Base): ---- snip ---- def count return super if subclass? subclasses.inject(0) { |sum, klass| sum += klass.count } end def subclass? subclasses.include? self end # here''s where the uninitialized constant comes in def subclasses(table_must_exist = true) Image::Base.subclasses table_must_exist end ---- snip ---- any ideas on what might cause this (mis-)behaviour would be greatly appreciated. TIA & cheers jens -- Jens Wille, Dipl.-Bibl. (FH) prometheus - Das verteilte digitale Bildarchiv für Forschung & Lehre An St. Laurentius 4, 50931 Köln Tel.: +49 (0)221 470-6668, E-Mail: jens.wille-31N1O1AsgN5n68oJJulU0Q@public.gmane.org http://www.prometheus-bildarchiv.de/ --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
we have just discovered that the problem only occurs in development mode -- production mode works fine. so it seems certain constants (modules/classes) "get lost" by rails'' (re-)loading behaviour in development mode. but how to overcome this issue? anyone care to help us out on this one? cheers jens jens wille [04/01/07 17:49]:> hi there! > > unfortunately, we are repeatedly having problems with uninitialized > constants in our rails app (v1.1.6), which is running on a mongrel > cluster behind apache''s mod_proxy_balancer. > > ---- snip ---- > NameError (uninitialized constant Base): > [...] > /app/models/image.rb:90:in `subclasses'' > /app/models/image.rb:98:in `subclass?'' > /app/models/image.rb:261:in `count'' > /app/controllers/image_controller.rb:95:in `list'' > ---- snip ---- > > "Base" is actually "Image::Base", defined in lib/image/base.rb: > class Image::Base. > > immediately after a mongrel_cluster restart it''s working for a few > requests, though. (approx. 4 requests, resulting from 4 mongrel > servers being run?) the strange thing just is that everything works > fine when run from script/console ... except when commenting out the > "require ''image/base''" from config/environment.rb! -- how come? > > > code details are as follows: > > app/controllers/image_controller.rb: class ImageController < > ApplicationController: > > ---- snip ---- > def list > # Image.count is where all evil originates > @images = ::Paginator.new(Image.count, 10) { |offset, per_page| > Image.find(:all, :limit => per_page, :offset => offset) > }.page(params[:page]) > end > ---- snip ---- > > > app/models/image.rb: class Image < Entity (Entity < ActiveRecord::Base): > > ---- snip ---- > def count > return super if subclass? > > subclasses.inject(0) { |sum, klass| > sum += klass.count > } > end > > def subclass? > subclasses.include? self > end > > # here''s where the uninitialized constant comes in > def subclasses(table_must_exist = true) > Image::Base.subclasses table_must_exist > end > ---- snip ---- > > any ideas on what might cause this (mis-)behaviour would be greatly > appreciated. > > TIA & cheers > jens >-- Jens Wille, Dipl.-Bibl. (FH) prometheus - Das verteilte digitale Bildarchiv für Forschung & Lehre An St. Laurentius 4, 50931 Köln Tel.: +49 (0)221 470-6668, E-Mail: jens.wille-31N1O1AsgN5n68oJJulU0Q@public.gmane.org http://www.prometheus-bildarchiv.de/ --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Jen - have you tried Image::ActiveRecord::Base? -Paul --~--~---------~--~----~------------~-------~--~----~ 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 paul! Paul Corcoran [05.01.2007 18:35]:> Hi Jen - have you tried Image::ActiveRecord::Base?well, no... since the class in question is actually Image::Base, not Image::ActiveRecord::Base. it''s only Image that /inherits/ from ActiveRecord::Base, via Entity. so i assume the path is totally correct - as running in production mode shows -, it''s just that this class (Image::Base) seems to be "there" only immediately after starting the mongrel servers (i.e., after loading the whole code base) -- which appears quite strange to me. i mean, why do i even have to require image/base in environment.rb in order to get that constant? i don''t usually have to for other classes and modules in lib/ (of course, there are other reasons why i might have to do that, which apply to image/base, too). it seems that this issue has in some way to do with the fact that Image already is a model class. but in what way? and what can we do about it? i''m kinda stuck... cheers jens -- Jens Wille, Dipl.-Bibl. (FH) prometheus - Das verteilte digitale Bildarchiv für Forschung & Lehre An St. Laurentius 4, 50931 Köln Tel.: +49 (0)221 470-6668, E-Mail: jens.wille-31N1O1AsgN5n68oJJulU0Q@public.gmane.org http://www.prometheus-bildarchiv.de/ --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I will jump in here, with more of a question than an answer. I am totally new to rails. Have developed an app locally on my laptop. It works fine. I just tried to set up my web host environment for the first time and it seems that ALL of my application classes are not being found when I run in production environment. Furthermore, in the "script/console production" , when I try to run Rails:Info I get NameError: uninitialized constant Rails::Info. Any quick tips for a newbie? On Jan 5, 9:17 pm, jens wille <jens.wi...-31N1O1AsgN5n68oJJulU0Q@public.gmane.org> wrote:> hi paul! > > Paul Corcoran [05.01.2007 18:35]:> Hi Jen - have you tried Image::ActiveRecord::Base?well, no... since the class in question is actually Image::Base, not > Image::ActiveRecord::Base. it''s only Image that /inherits/ from > ActiveRecord::Base, via Entity. so i assume the path is totally > correct - as running in production mode shows -, it''s just that this > class (Image::Base) seems to be "there" only immediately after > starting the mongrel servers (i.e., after loading the whole code > base) -- which appears quite strange to me. > > i mean, why do i even have to require image/base in environment.rb > in order to get thatconstant? i don''t usually have to for other > classes and modules in lib/ (of course, there are other reasons why > i might have to do that, which apply to image/base, too). it seems > that this issue has in some way to do with the fact that Image > already is a model class. but in what way? and what can we do about > it? i''m kinda stuck... > > cheers > jens > > -- > Jens Wille, Dipl.-Bibl. (FH) > prometheus - Das verteilte digitale Bildarchiv für Forschung & Lehre > An St. Laurentius 4, 50931 Köln > Tel.: +49 (0)221 470-6668, E-Mail: jens.wi...-31N1O1AsgN5SPdVFqHYbYQ@public.gmane.org://www.prometheus-bildarchiv.de/--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
nevermind :) Pilot error copying files onto web host was my problem. On Jan 6, 8:33 am, "rovnak" <donloga...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I will jump in here, with more of a question than an answer. I am > totally new to rails. Have developed an app locally on my laptop. It > works fine. I just tried to set up my web host environment for the > first time and it seems that ALL of my application classes are not > being found when I run in production environment. Furthermore, in the > "script/console production" , when I try to run Rails:Info I get > NameError: uninitialized constant Rails::Info. Any quick tips for a > newbie? > > On Jan 5, 9:17 pm, jens wille <jens.wi...-31N1O1AsgN5n68oJJulU0Q@public.gmane.org> wrote: > > > hi paul! > > > Paul Corcoran [05.01.2007 18:35]:> Hi Jen - have you tried Image::ActiveRecord::Base?well, no... since the class in question is actually Image::Base, not > > Image::ActiveRecord::Base. it''s only Image that /inherits/ from > > ActiveRecord::Base, via Entity. so i assume the path is totally > > correct - as running in production mode shows -, it''s just that this > > class (Image::Base) seems to be "there" only immediately after > > starting the mongrel servers (i.e., after loading the whole code > > base) -- which appears quite strange to me. > > > i mean, why do i even have to require image/base in environment.rb > > in order to get thatconstant? i don''t usually have to for other > > classes and modules in lib/ (of course, there are other reasons why > > i might have to do that, which apply to image/base, too). it seems > > that this issue has in some way to do with the fact that Image > > already is a model class. but in what way? and what can we do about > > it? i''m kinda stuck... > > > cheers > > jens > > > -- > > Jens Wille, Dipl.-Bibl. (FH) > > prometheus - Das verteilte digitale Bildarchiv für Forschung & Lehre > > An St. Laurentius 4, 50931 Köln > > Tel.: +49 (0)221 470-6668, E-Mail: jens.wi...-31N1O1AsgN5SPdVFqHYbYQ@public.gmane.org://www.prometheus-bildarchiv.de/--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Possibly Parallel Threads
- mod_proxy and subdomains..
- [JOB] Softwareentwickler/-in, prometheus-Bildarchiv, Universität zu Köln
- [JOB] Softwareentwickler/-in, prometheus-Bildarchiv, Universität zu Köln
- [JOB] Softwareentwickler/-in, prometheus-Bildarchiv, Universität zu Köln
- Samba 4 AD and Samba 3.6 Fileserver GID Problem