Open ashleym1972 opened 15 years ago
Has there been any other fix for this? I tried this fix out and found that it ended up meaning nothing would end up getting cached...
Sorry, I didn't update. We found the fix didn't work out. We ended up moving the Locale classes to the model. There is really no other way of fixing this.
Do you mean you moved the file that defined Locale to app/models out of vendor? Did you still have to make the change in the code?
Or do you mean you had to take the code in the Locale plugin and put it directly into any of the models that were going to use it?
Think I found the fix:
in abstract.rb:
def indexed_on?(attributes)
begin
indices.detect { |index| index == attributes }
rescue NoMethodError
return nil
end
end
That could do it. We just moved the locale.rb file to our models directory.
That worked for me!!! for an unknown reason, this ticket's info is not easily found via a google search of the error. It would be great to integrate it into the main rep.
Committed it to my fork.
When I ran with the Locale plugin I got this error: NoMethodError (You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.indices): (DELEGATION):2:in
__send__' (__DELEGATION__):2:in
indices' (DELEGATION):2:in__send__' (__DELEGATION__):2:in
indices' vendor/gems/nkallen-cache-money-0.2.5/lib/cash/query/abstract.rb:114:inindexed_on?' vendor/gems/nkallen-cache-money-0.2.5/lib/cash/query/abstract.rb:56:in
cacheable?' vendor/gems/nkallen-cache-money-0.2.5/lib/cash/query/abstract.rb:15:inperform' vendor/gems/nkallen-cache-money-0.2.5/lib/cash/query/abstract.rb:7:in
perform' vendor/gems/nkallen-cache-money-0.2.5/lib/cash/finders.rb:24:infind_every' vendor/gems/mislav-will_paginate-2.2.3/lib/will_paginate/finder.rb:164:in
method_missing' app/controllers/application_controller.rb:69:in `set_locale_from_request'Which was caused by the Locale ActiveRecords being located in the vendor tree and not our main tree. To solve this we added this line to abstract.rb:52