getting ActiveRecord errors when using mongoid and Sql on Ironworker files

(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:in define_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:in block 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:in define_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:in block in define_attribute_methods' from /task/gems/activemodel/lib/active_model/attribute_methods.rb:256:in each' 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:in define_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 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:in run_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:in instantiate' 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:in collect!' 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:in to_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:in first' 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:in method_missing' from /task/user_setup.rb:74:in new_user_setup' from /task/user_setup.rb:39:in initialize' from /task/justa_worker.rb:48:in new' from /task/justa_worker.rb:48:in run' from /task/runner.rb:405:in `'


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:

  • Check again gem versions actually used
  • Manually set exact version (second parameter in merge_gem)
  • Use magic construction gem 'mygem', '=0.1.2' somewhere in ruby code
  • 链接地址: http://www.djcxy.com/p/81124.html

    上一篇: Rails 4模型是有效的,但不会保存?

    下一篇: 在Ironworker文件上使用mongoid和Sql时出现ActiveRecord错误