getting ActiveRecord errors when using mongoid and Sql on Ironworker files

420 views Asked by At

(I am relatively new to Rails)

I have a file (Ruby) I am running/uploading through Ironworker that is currently using MySql (activeRecord) for database. ALl works fine, but We now have a need for a new (additional) Model that will use Mongoid that will also be included in our code uploaded to IronWorker. When I include the following line merge_gem 'mongoid' to my IronWorker file I get:

DEPRECATION WARNING: Specifying an empty prefix/suffix for an attribute method is no longer necessary. If the un-prefixed/suffixed version of the method has not been defined when define_attribute_methods is called, it will be defined automatically. (called from block in at /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.1.6/lib/active_record/attribute_methods/read.rb:9)

DEPRECATION WARNING: synchronize is deprecated and will be removed from Rails 3.2. (called from at /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:298) DEPRECATION WARNING: define_attr_method is deprecated and will be removed without replacement. (called from set_table_name at /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.1.6/lib/active_record/base.rb:660) DEPRECATION WARNING: define_attr_method is deprecated and will be removed without replacement. (called from set_locking_column at /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.1.6/lib/active_record/locking/optimistic.rb:150) /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.1.6/lib/active_record/attribute_methods/read.rb:82:in define_read_method': uninitialized constant ActiveModel::AttributeMethods::COMPILABLE_REGEXP (NameError) from /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.1.6/lib/active_record/attribute_methods/read.rb:42:indefine_method_attribute' from /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.1.6/lib/active_record/attribute_methods/time_zone_conversion.rb:35:in define_method_attribute' from /task/gems/activemodel/lib/active_model/attribute_methods.rb:267:inblock in define_attribute_method' from /task/gems/activemodel/lib/active_model/attribute_methods.rb:260:in each' from /task/gems/activemodel/lib/active_model/attribute_methods.rb:260:indefine_attribute_method' from /task/gems/activemodel/lib/active_model/attribute_methods.rb:256:in block in define_attribute_methods' from /task/gems/activemodel/lib/active_model/attribute_methods.rb:256:ineach' from /task/gems/activemodel/lib/active_model/attribute_methods.rb:256:in define_attribute_methods' from /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.1.6/lib/active_record/attribute_methods.rb:14:indefine_attribute_methods' from /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.1.6/lib/active_record/attribute_methods.rb:65:in respond_to?' from /task/gems/activesupport/lib/active_support/callbacks.rb:398:in__run_callback' from /task/gems/activesupport/lib/active_support/callbacks.rb:385:in _run_find_callbacks' from /task/gems/activesupport/lib/active_support/callbacks.rb:81:inrun_callbacks' from /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.1.6/lib/active_record/base.rb:1617:in init_with' from /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.1.6/lib/active_record/base.rb:959:ininstantiate' from /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.1.6/lib/active_record/base.rb:470:in block in find_by_sql' from /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.1.6/lib/active_record/base.rb:470:incollect!' from /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.1.6/lib/active_record/base.rb:470:in find_by_sql' from /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.1.6/lib/active_record/relation.rb:112:into_a' from /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.1.6/lib/active_record/relation/finder_methods.rb:376:in find_first' from /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.1.6/lib/active_record/relation/finder_methods.rb:122:infirst' from /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.1.6/lib/active_record/relation/finder_methods.rb:263:in find_by_attributes' from /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.1.6/lib/active_record/base.rb:1070:inmethod_missing' from /task/user_setup.rb:74:in new_user_setup' from /task/user_setup.rb:39:ininitialize' from /task/justa_worker.rb:48:in new' from /task/justa_worker.rb:48:inrun' from /task/runner.rb:405:in `'

1

There are 1 answers

0
thousandsofthem On

First of all, iron_worker gem deprecated a while ago. Update your code to iron_worker_ng gem ( https://github.com/iron-io/iron_worker_ruby_ng ), if you can. This action will solve 99.9% issues with merging gems (it's primary reason of writing new gem)

Probable reason: gem version mismatch, mostly rails gems. activerecord/activesupport/etc

Try to:

  1. Check again gem versions actually used
  2. Manually set exact version (second parameter in merge_gem)
  3. Use magic construction gem 'mygem', '=0.1.2' somewhere in ruby code