App in Rails 4.0.12 / Ruby 2.0.0p481
runs without problems on production and on one dev notebook
completely isolated with rbenv / bundle / svn
trying to get it up in another dev pc and I hit when starting server with
bundle exec rails s
LoadError - Unable to autoload constant Venta, expected /home/sistemas/Projects/microgestion/trunk/app/models/concerns/modelos_impresion/venta.rb to define it:
activesupport (4.0.13) lib/active_support/dependencies.rb:464:in load_missing_constant'
activesupport (4.0.13) lib/active_support/dependencies.rb:184:inconst_missing'
activesupport (4.0.13) lib/active_support/dependencies.rb:495:in load_missing_constant'
activesupport (4.0.13) lib/active_support/dependencies.rb:184:in `const_missing'
Now /home/sistemas/Projects/microgestion/trunk/app/models/concerns/modelos_impresion/venta.rb has this defined:
module Concerns::ModelosImpresion::Venta
but the correct class Venta is defined at:
/home/sistemas/Projects/microgestion/trunk/app/model/ventas/venta.rb:
class Venta < ActiveRecord::Base
...
end
In config/application.rb I have:
# Custom directories with classes and modules you want to be autoloadable.
config.autoload_paths += Dir["#{config.root}/app/models/**/", "#{config.root}/app/services/**/", "#{config.root}/lib/**/"]
I know the two files have the same name, but I looked like because they were on different hierarchies it didn't matter..
Now the million dollar question is, why if in two environments is resolving correctly the dependency to the correct file but not in this particular PC with everything isolated correctly?
There is some non-deterministic behaviour in the way Rails resolves the 'missing constant' dependencies to files?