Created
May 9, 2011 05:00
-
-
Save kidpollo/962080 to your computer and use it in GitHub Desktop.
Tanker Gist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Product < ActiveRecord::Base | |
include Tanker | |
tankit 'my_index' do | |
indexes :name | |
indexes :description | |
end | |
after_save :update_tank_indexes | |
after_destroy :delete_tank_indexes | |
end | |
@catapult = Product.create(:name => 'Acme catapult') | |
@tnt = Product.create(:name => 'Acme TNT') | |
@cat = Product.create(:name => 'Acme cat') | |
Product.search_tank('Acme') | |
# [ | |
# <Product id: 1, name: "Acme catapult" ... > | |
# <Product id: 2, name: "Acme TNT" ... > | |
# <Product id: 3, name: "Acme cat" ... > | |
# ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment