1

The thing is there is a rubygem which adds some syntactic sugar to RoR ActiveRecord for defining filters and orders. We were using meta_where, then switched to squeel to get rails 3 support. The thing is that everything worked fine with ActiveRecord <= 3.0.10, now when I tried to switch to 3.1.0 in the gem I'm getting this error:

/Users/admin/.rvm/gems/ree-1.8.7-2011.03@filters/gems/activerecord-3.1.0/lib/active_record/named_scope.rb:194:in `valid_scope_name?': private method `warn' called for nil:NilClass (NoMethodError)

The whole trace is as follows:

/Users/admin/.rvm/gems/ree-1.8.7-2011.03@filters/gems/activerecord-3.1.0/lib/active_record/named_scope.rb:194:in `valid_scope_name?': private method `warn' called for nil:NilClass (NoMethodError)
    from /Users/admin/.rvm/gems/ree-1.8.7-2011.03@filters/gems/activerecord-3.1.0/lib/active_record/named_scope.rb:175:in `scope'
    from ./test/simplificator_filter/filterable/filterable_test.rb:12
    from /Users/admin/.rvm/gems/ree-1.8.7-2011.03@filters/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:234:in `load'
    from /Users/admin/.rvm/gems/ree-1.8.7-2011.03@filters/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:234:in `load'
    from /Users/admin/.rvm/gems/ree-1.8.7-2011.03@filters/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
    from /Users/admin/.rvm/gems/ree-1.8.7-2011.03@filters/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'
    from /Users/admin/.rvm/gems/ree-1.8.7-2011.03@filters/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
    from /Users/admin/.rvm/gems/ree-1.8.7-2011.03@filters/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:234:in `load'
    from /Users/admin/.rvm/gems/ree-1.8.7-2011.03@global/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
    from /Users/admin/.rvm/gems/ree-1.8.7-2011.03@global/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `each'
    from /Users/admin/.rvm/gems/ree-1.8.7-2011.03@global/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5

rake aborted!

I searched for similar errors but found nothing (mostly pasties of traces). Does anyone knows what might be the problem?

Thank you in advance. Cheers, Neithan

Neithan
  • 11
  • 2

2 Answers2

1

The behaviour when reloading models has changed. While 3.0 doesn't bother to load 'app/models/post.rb' 3.1 throws this error. When you love to interactively refine your models on the console, you have to delete the model with Object.send :remove_const, 'Post' before.

fbehrens
  • 6,115
  • 2
  • 19
  • 22
0

I managed to fix it.

It turned out the problem was in the test suite. Since this gem was about adding some syntactic sugar for defining filters and orders it interfered int the ActiveRecord.

Apparently doing so causes problem while reevaluating classes or having classes with the same names in test cases, after removing that everything worked.

Neithan
  • 11
  • 2