Skip to content

Instantly share code, notes, and snippets.

@hemju
Created January 4, 2011 10:15
Show Gist options
  • Save hemju/764613 to your computer and use it in GitHub Desktop.
Save hemju/764613 to your computer and use it in GitHub Desktop.
class Book < ActiveRecord::Base
belongs_to :auther
searchable do
text :title, :default_boost => 2
text :description
time :updated_at # for sorting by recent
integer :auther_id, :multi => true do
authers.map {|auther| auther.auther_id}
end
boolean :published, :using => :published?
end
def published?
state == :published
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment