Skip to content

Instantly share code, notes, and snippets.

Created January 28, 2013 15:21
Show Gist options
  • Save anonymous/96f1f84f056b8deb24ed to your computer and use it in GitHub Desktop.
Save anonymous/96f1f84f056b8deb24ed to your computer and use it in GitHub Desktop.
# okay
after_save :search_reindex, :if => lambda { |r|
Searchable.enabled? &&
r.changes.present? &&
(r.search_indexed_fields & r.changes.keys.select {|k| r.changes[k]}.collect(&:to_sym)).any?
}
# tried to create Proc object without a block
after_save :search_reindex, :if => lambda do |r|
Searchable.enabled? &&
r.changes.present? &&
(r.search_indexed_fields & r.changes.keys.select {|k| r.changes[k]}.collect(&:to_sym)).any?
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment