Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transitions::InvalidMethodOverride error on rake sunspot:reindex task #66

Closed
thedarkside opened this issue Nov 11, 2012 · 4 comments
Closed

Comments

@thedarkside
Copy link

Hi,

i just run into this problem while trying to integrate sunspot in a rails3 project https://github.com/outoftime/sunspot
After executing "rake sunspot:reindex" it gives me this error:

rake aborted!
Transitions::InvalidMethodOverride

Tasks: TOP => sunspot:reindex

My Customer class - where the exception is thrown - looks like this

class Customer < ActiveRecord::Base
  include ActiveModel::Transitions
...
  state_machine :initial => :unregistered, :auto_scopes => true do
    state :unregistered
    state :registered

    event :register, :timestamp => true do
      transitions :to => :registered, :from => :unregistered
    end
  end
...
end

and the exception is thrown where the "state_machine" line is.

why is the exception thrown here? what can i do to fix this?

@troessner
Copy link
Owner

Hmmmm,

what gem version? Also, please paste the complete stacktrace.

@thedarkside
Copy link
Author

I found the problem.
The sunspot rake task requires the model again although it is already loaded and that executes the state_machine method again which tries to redeclare the already existing scopes...
Seems like the problem needs to be fixed on the sunspot side.
What do you think?

@troessner
Copy link
Owner

Off of the top of my head, yes, I'd say that's a "sunspot" problem. I can't think of any valid reasons to do this, so you probably should open up an issue there.

@thedarkside
Copy link
Author

ok thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants