I've been trying to upgrade from 1.2.9 to the latest source on github.
After I do a simple "rm -rf vendor/plugins/thinking-sphinx && script/
plugin install git://github.com/freelancing-god/thinking-sphinx.git" I
start getting errors with inheritable attributes on STI classes.
At first, add_sphinx_index would barf because the inheriting class's
#sphinx_indexes was nil. That was easy to monkey patch, but then
acts_as_state machine barfs because
InheritingClass.read_inheritable_attribute(:states) returns nil. I've
looked through our code and removed everything custom we're doing with
inheritance, but the only way I can fix the problem is by going back
to TS 1.2.9. To illustrate:
---
$ git reset --hard HEAD && git clean -fd
<snip>
$ script/console
Loading development environment (Rails 2.3.2)
>> p User.states;p EmbeddedUser.states
[:deleted, :suspended, :confirmed, :live]
[:deleted, :suspended, :confirmed, :live]
=> nil
>> exit
$ rm -rf vendor/plugins/thinking-sphinx && script/plugin install
git://github.com/freelancing-god/thinking-sphinx.git
Initialized empty Git repository in <scrub>/vendor/plugins/thinking-
sphinx/.git/
remote: Counting objects: 246, done.
remote: Compressing objects: 100% (223/223), done.
remote: Total 246 (delta 16), reused 163 (delta 2)
Receiving objects: 100% (246/246), 183.83 KiB, done.
Resolving deltas: 100% (16/16), done.
From git://github.com/freelancing-god/thinking-sphinx
* branch HEAD -> FETCH_HEAD
If you're upgrading, you should read this:
http://freelancing-god.github.com/ts/en/upgrading.html
$ script/console
Loading development environment (Rails 2.3.2)
>> p User.states;p EmbeddedUser.states
[:deleted, :suspended, :confirmed, :live]
NoMethodError: You have a nil object when you didn't expect it!
The error occurred while evaluating nil.keys
from <scrub>/vendor/plugins/acts_as_state_machine/lib/
acts_as_state_machine.rb:177:in `states'
from (irb):1
---
Can anyone think of changes to inheritable attributes in recent
revisions of TS? Any other gotchas around STI?
I'm on Rails 2.3.2.
Thanks much,
Ian Smith-Heisters
Senior Web Developer
Howcast Media
not sure this helps, but I had similar problems when upgrading TS
until I moved all my plugins to the corresponding gems.
Seems like load-order may introduce subtle abnormalities for certain
plugins/gems.
For example, try installing acts_as_state_machine as a gem and put TS
last in your environment.rb.
Also, don't forget to adjust your config.gem-line after upgrading to
something like this (like mentioned in the ts-upgrading instructions):
[...]
config.gem(
'thinking-sphinx',
:lib => 'thinking_sphinx',
:version => '~> 1.3.8'
)
[...]
Hope this helps,
Claus
If you're open to giving me access to your app's code, it'd be great if I could investigate this with code where I can reproduce it. I've no idea why TS would change the behaviour of read_inheritable_attribute.
Feel free to contact me offlist if you're happy to do this.
--
Pat
> --
>
> You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group.
> To post to this group, send email to thinkin...@googlegroups.com.
> To unsubscribe from this group, send email to thinking-sphi...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.
>
>