This one is really tricking me out. I’ve made a minimal sample app
that reproduces the problem I’m facing, it’s at
http://github.com/carpeliam/plogger_ts_devise_problem_example. Some
minimal explanation is there as well, the rest of this note is both
backstory and elaboration. I’m developing a blogging plugin
http://github.com/carpeliam/plogger which is plugin-based itself (much
like feather for Merb), where any features you want in addition to
dead simple posting come in the form of plugins themselves. Instead of
using generators, I’ve tried to keep everything out of the app and
under vendor/plugins. This means that the Article class is in the
plogger plugin, and any Sphinx-related modifications to Article are
made in the plogger_thinking_sphinx plugin.
My problem is, for some reason, the modification I’m making in my
plogger_thinking_sphinx plugin is throwing off some of my routes I’m
using with other gems. Specifically, I’m using Devise for
authentication, and my sign_in/sign_out links are disappearing-- but
ONLY in “production” mode. In addition, any authentication-related
before_filters in my controllers are being ignored, so authentication
is silently failing.
The offending code is in plogger_thinking_sphinx, where I’m adding
define_index to my model as follows:
require ‘thinking_sphinx’
Article.send :define_index, &(lambda do
indexes title
indexes description
indexes post
has created_at
set_property :delta => true
end)
This works fine in “development” mode. I also don’t see any problems
from just requiring “thinking_sphinx”, I only see problems when I
call Article.send :define_index. Why that would mess up my Devise
routes, and even then only in production, I have no idea. Any insight
into this problem would be deeply appreciated.