I have been charged with resurrecting a rails 2.3.5 app and was told not to do any tool upgrades.
At the end of our environment.rb we load our products into our ProductCatalog like so ProductCatalog.load
This then populates the array in the ProductCatalog module which looks like so module ProductCatalog
@@products =
def ProductCatalog.load_prod_cat @@products = Product.find(:all, :order => "desc") end
def ProductCatalog.get_product(prod_id, prod_vers_id) @@products.find do |prod| prod.prod_id.eql?(prod_id) and prod.prod_vers_id.eql? (prod_vers_id) end end end
calling get product works perfectly and finds the correct product based on prod_id and prod_vers_id (composit_primary_keys is being used for this on the model).
The problem arises in the template when we try to iterate over the array of products we pass in (array is populated via individual calls to ProductCatalog.get_product) and we try to traverse the has_many :pricing_structures association.
At this point a method_missing error gets thrown.
This error only occurs in development mode and has me completely dumbfounded. Our work around is to develop in production mode but that's a pain because we have to restart the server everytime which is a lengthy process due to setup that occurs via calls to a webservice.
Any help would be fantastic