I created a test app that highlights the problem: https://github.com/jtushman/classloadingissue
On Nov 23, 8:46 am, jonathan <[email protected]> wrote: > I should add, that the class kind-of gets loaded, Checkout the > following rails console sequence: > > [2] > Reductions::ConversionsByBucket > => Reductions::ConversionsByBucket > [3] > Reductions::ConversionsByBucket.class > => Class > [4] > Reductions::ConversionsByBucket.hello > NoMethodError: undefined method `hello' for > Reductions::ConversionsByBucket:Class > > [5] > require 'reductions/conversions_by_bucket.rb' > => nil > [6] > Reductions::ConversionsByBucket.hello > => "hello" > > On Nov 23, 8:08 am, jonathan <[email protected]> wrote: > > > > > > > > > Yeah I thought that too -- but i have looked it over hundreds of times > > and can't find the mismatch. I have simplifed the classes to just > > have the hello method. And still have the same behavior. Here are > > the three classes > > > #app/models/reductions/impressions_by_hour.rb > > class Reductions::ImpressionsByHour > > def self.hello > > "hello" > > end > > end > > > #app/models/reductions/conversions_by_hour.rb > > class Reductions::ConversionsByHour > > def self.hello > > "hello" > > end > > end > > > #app/models/reductions/conversions_by_bucket.rb > > class Reductions::ConversionsByBucket > > def self.hello > > "hello" > > end > > end > > > ls app/models/reductions/ > > base.rb conversions_by_bucket.rb > > conversions_by_hour.rb impressions_by_hour.rb unions.rb > > > The relationship between the classes is that they all perform map/ > > reduce methods. base.rb holds common code between them > > > I'm sure its something simple, but I am stumped! > > > -- Jonathan > > > On Nov 23, 4:29 am, mkristian <[email protected]> wrote: > > > > I have the feeling the class-names are bit mismatched. what is the > > > relation between Reductions::ConversionsByBucket and > > > Reductions::ImpressionsByBucket ? > > > > - Kristian > > > > On Nov 23, 6:24 am, jonathan <[email protected]> wrote: > > > > > Hi guys, > > > > > I am stuck on, what i think is a class loader issue. > > > > > In my app/models directory i have the following files: > > > > > reductions/base.rb > > > > reductions/conversions_by_bucket.rb > > > > reductions/conversions_by_hour.rb > > > > reductions/impressions_by_hour.rb > > > > > (background -- i am using mongoid, and i use these files to manage > > > > mapReduce) > > > > > These classes only have class methods. In each of these classes I > > > > added the following method: > > > > > def self.hello > > > > "hello" > > > > end > > > > > And checkout this weirdness from the rails console: > > > > > > Reductions::ImpressionsByHour.hello > > > > => "hello" > > > > > Reductions::ConversionsByHour.hello > > > > => "hello" > > > > > Reductions::ImpressionsByBucket.hello > > > > > NoMethodError: undefined method `hello' for > > > > Reductions::ImpressionsByBucket:Class > > > > > BUT ... > > > > > > require 'reductions/conversions_by_bucket.rb' > > > > => nil > > > > > Reductions::ConversionsByBucket.hello > > > > > => "hello" > > > > > Soooooo weird!!! So why is reductions/conversions_by_bucket.rb not > > > > being loaded by the class loader?! > > > > > I am using rails 3.0.3 > > > > > Thanks!! -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

