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

human_state throws an exception when ActiveRecord is not available #113

Closed
silentshade opened this issue Feb 28, 2014 · 1 comment
Closed
Assignees
Labels

Comments

@silentshade
Copy link

When ActiveRecord is not available in production (eg if using Mongoid AR is not loaded) the model_instance.aasm.human_state throws an exception:

NameError: uninitialized constant AASM::Localizer::ActiveRecord

This is because AASM::Localizer#ancestros_list references this class:

def ancestors_list(klass)
  klass.ancestors.select do |ancestor|
    ancestor.respond_to?(:model_name) unless ancestor == ActiveRecord::Base
  end
end

Quick fix is to use class.name instead:

def ancestors_list(klass)
  klass.ancestors.select do |ancestor|
    ancestor.respond_to?(:model_name) unless ancestor.name == 'ActiveRecord::Base'
  end
end
@alto alto added the bug label Feb 28, 2014
@alto alto self-assigned this Feb 28, 2014
@alto
Copy link
Member

alto commented Mar 1, 2014

Thanks for pointing this out! I released version 3.1.1 to fix this.

@alto alto closed this as completed Mar 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants