Skip to content

Instantly share code, notes, and snippets.

@beck03076
Created July 4, 2014 17:47
Show Gist options
  • Save beck03076/e6b64c784084a7627d60 to your computer and use it in GitHub Desktop.
Save beck03076/e6b64c784084a7627d60 to your computer and use it in GitHub Desktop.
class Product
include Mongoid::Document
include Mongoid::Timestamps::Short
include Tire::Model::Search
include Tire::Model::Callbacks
cattr_accessor :mag_libs_cache
def self.get_prods_by_mode(store, options={})
self.mag_libs_cache ||= {}
mag_lib = self.mag_libs_cache[store.id] ||= self.model_name.constantize.get_mag_lib(store)
.-- more code --
.
.
end
def self.populate! store_id, options={}
self.mag_libs_cache ||= {}
mag_lib = self.mag_libs_cache[store.id] ||= self.model_name.constantize.get_mag_lib(store)
.-- more code --
.
.
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment