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

Seeing undefined method `_validation_callbacks' with Rails 4.0.4 #1593

Closed
webandtech opened this issue Mar 29, 2014 · 2 comments
Closed

Seeing undefined method `_validation_callbacks' with Rails 4.0.4 #1593

webandtech opened this issue Mar 29, 2014 · 2 comments

Comments

@webandtech
Copy link

Not sure if this is a jruby or rails bug. After updating my gems to Rails 4.0.4 and re-running my integration tests, I intermittently see errors like the ones below. It seems to be related to my before_validation callbacks in my ActiveRecord models.

Downgrading to Rails 4.0.3 fixes the error.

Undefined method _run__1942824238__validation__callbacks for class 'User' (NameError)
undefined method `_validation_callbacks' for #<Class:0x56275160> (NoMethodError)
ERROR -- : Undefined method _validation_callbacks for 'User' (NameError)
org/jruby/RubyModule.java:2297:in `undef_method'
/Users/asevers/.rvm/gems/jruby-1.7.11@frederick/gems/activesupport-4.0.4/lib/active_support/core_ext/module/remove_method.rb:4:in `remove_possible_method'
/Users/asevers/.rvm/gems/jruby-1.7.11@frederick/gems/activesupport-4.0.4/lib/active_support/core_ext/class/attribute.rb:86:in `_validation_callbacks='
org/jruby/RubyModule.java:2304:in `module_eval'
/Users/asevers/.rvm/gems/jruby-1.7.11@frederick/gems/activesupport-4.0.4/lib/active_support/core_ext/class/attribute.rb:85:in `_validation_callbacks='
/Users/asevers/.rvm/gems/jruby-1.7.11@frederick/gems/activesupport-4.0.4/lib/active_support/callbacks.rb:454:in `set_callback'
/Users/asevers/.rvm/gems/jruby-1.7.11@frederick/gems/activesupport-4.0.4/lib/active_support/callbacks.rb:0:in `__update_callbacks'
org/jruby/RubyArray.java:1613:in `each'
/Users/asevers/.rvm/gems/jruby-1.7.11@frederick/gems/activesupport-4.0.4/lib/active_support/callbacks.rb:402:in `__update_callbacks'
/Users/asevers/.rvm/gems/jruby-1.7.11@frederick/gems/activesupport-4.0.4/lib/active_support/callbacks.rb:447:in `set_callback'
/Users/asevers/.rvm/gems/jruby-1.7.11@frederick/gems/activemodel-4.0.4/lib/active_model/validations/callbacks.rb:60:in `before_validation'
@atambo
Copy link
Member

atambo commented Apr 27, 2014

This might be a multi-threading bug where multiple threads are adding/removing methods from the same class? I would report this to rails.

@kares
Copy link
Member

kares commented Jun 27, 2017

@atambo is correct, this is really a Rails issue - whether they guarantee thread-safety with validations.
likely not the AR model is not designed for sharing models between threads, you've just been 'lucky'.

@kares kares closed this as completed Jun 27, 2017
@kares kares added this to the Invalid or Duplicate milestone Jun 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants