On Thursday, September 13, 2012 1:43:22 PM UTC-4, mrloz wrote:
>
> This doesn't look like a rails issue.  It looks like ruby expected 
> behaviour, unless I misunderstand.
>
> The constant ModuleSpecificModel doesn't exist.  Only 
> SomeModule::ModuleSpecificModel exists.  Ruby auto loading or rails 
> autoloading would not expect this code to 'install' the 
> ModuleSpecificModule at the top level ( I.e ::ModuleSpecificModel )
>

Thanks!

When perusing activesupport/lib/activesupport/dependencies.rb, I had 
assumed that if you were in the same module as the class (or in the last 
example, within the class itself) that it would attempt to find that class 
in the current module even if you didn't specify a module, but it doesn't 
seem like it should be looking for: 
SomeModule::ModuleSpecificModel::ModuleSpecificModel when referring to 
ModuleSpecificModel within the ModuleSpecificModel class itself.

But I think my confusion was assuming that there is a different from a 
constant that is a class and a constant that is some other type. That is 
the Java side of my brain interfering.

Sorry to bother about this. I was hoping that dependency resolution could 
be used to refer to a model class from another model class and it 
automatically find it in the root module if it didn't exist in the current 
module, but I had forgotten about other types of constants and how that 
would throw a wrench in things if it worked that way.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-core/-/1GHjJXf8Vy8J.
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-core?hl=en.

Reply via email to