Hi Ian 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 On 23/12/2009, at 7:29 AM, [email protected] wrote: > Hi all, > > 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 > > -- > > You received this message because you are subscribed to the Google Groups > "Thinking Sphinx" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/thinking-sphinx?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.
