forked from OpenNeo/impress
Stop freaking out if we try to remove a closet hanger but it's already dropped from search
This commit is contained in:
parent
b98021d704
commit
4d0c72f3b1
1 changed files with 12 additions and 2 deletions
|
@ -42,7 +42,17 @@ class ClosetHanger < ActiveRecord::Base
|
|||
|
||||
if Flex::Configuration.hangers_enabled
|
||||
flex.parent :item, 'item' => 'closet_hanger'
|
||||
flex.sync self
|
||||
flex.sync self, callbacks: [:save] # we handle destroy more carefully
|
||||
end
|
||||
|
||||
after_destroy do
|
||||
begin
|
||||
flex.remove
|
||||
rescue Flex::HttpError
|
||||
# This usually means that the record was already dropped from
|
||||
# the search engine. Weird, but okay; if the search engine is
|
||||
# erroneously in the correct state, let it be.
|
||||
end
|
||||
end
|
||||
|
||||
def flex_source
|
||||
|
|
Loading…
Reference in a new issue