Skip to content
notch8 edited this page Sep 13, 2010 · 3 revisions

Tanning Bed doesn’t require ActiveRecord or any other ORM. It can be used by any Ruby class.

class Model
  include ::TanningBed # This gets you the library for a given model file

  # You can also do batch adding by moving solr_add to a script
  # tailor to what ever you callback structure is
  save_callback    :after,   :solr_add
  destroy_callback    :after,   :solr_delete

  # This is just an array of method names to call on your model.
  # In the couchdb example self.keys returns all the Couchdb datafields.
  # Here we remove one we don't want to index and then add some non-field
  # methods we want to index
  def solr_keys
      keys - ["providers"] + ["discipline_name", "category_names", "available_provider_names", "certifications_facet", "countries_facet", "starts_with_facet"] + WareAnnotation.annotation_list
  end
end
Clone this wiki locally