bypassing index access in dev environment

9 views
Skip to first unread message

mike....@gmail.com

unread,
Jan 16, 2015, 3:29:53 PM1/16/15
to ruby-s...@googlegroups.com
I just experienced a problem that was preventing me from destroying a record of an indexed class because my dev environment does not point to a websolr index.

I tried working around this by registering solr_remove_from_index as a method to be pushed into the background (I use delayed_job in this project).  That way, I figured, the error would happen in the background instead of halting and rolling back the delete.

This approach didn't work for me - it seems that remove was being called but solr_remove_from_index was not - some other method was causing the removal.  I didn't see where the destroy callbacks were registered in the plugin.

So I switched to a workaround that I am somewhat more concerned about.  I wrapped my entire searchable block in a conditional that only runs in my production environment.

So far it seems to work because search is only used by one part of my application.  However it seems like a hack that is liable to cause problems at some point - are there better strategies available for this?

I can post a stack trace of the error that was rolling back the destroy if that would be helpful.  Thanks a lot!!

-Mike
Reply all
Reply to author
Forward
0 new messages