gpt4 book ai didi

mysql - activemdb基类不能继承?

转载 作者:行者123 更新时间:2023-11-29 02:31:34 27 4
gpt4 key购买 nike

我正在尝试通过 activemdb gem Access Rails 中的 mdb 文件。我遇到的问题是,每当我尝试 Access 或使用此 gem 时,它都会出现以下错误

NameError: uninitialized constant ActiveMDB
from /home/confiz/.rvm/gems/ruby-1.8.7-p358@lms/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:469:in `load_missing_constant'
from /home/confiz/.rvm/gems/ruby-1.8.7-p358@lms/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:106:in `const_missing'
from /home/confiz/.rvm/gems/ruby-1.8.7-p358@lms/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:118:in `const_missing'
from /home/confiz/Project/redmine/LMS/redmine-1.4/app/models/beacon.rb:2
from /home/confiz/.rvm/gems/ruby-1.8.7-p358@lms/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:406:in `load_without_new_constant_marking'
from /home/confiz/.rvm/gems/ruby-1.8.7-p358@lms/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:406:in `load_file'
from /home/confiz/.rvm/gems/ruby-1.8.7-p358@lms/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:547:in `new_constants_in'
from /home/confiz/.rvm/gems/ruby-1.8.7-p358@lms/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:405:in `load_file'
from /home/confiz/.rvm/gems/ruby-1.8.7-p358@lms/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:285:in `require_or_load_without_engine_additions'
from /home/confiz/Project/redmine/LMS/redmine-1.4/vendor/plugins/engines/lib/engines/rails_extensions/dependencies.rb:132:in `require_or_load'
from /home/confiz/.rvm/gems/ruby-1.8.7-p358@lms/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:451:in `load_missing_constant'
from /home/confiz/.rvm/gems/ruby-1.8.7-p358@lms/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:106:in `const_missing'
from /home/confiz/.rvm/gems/ruby-1.8.7-p358@lms/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:118:in `const_missing'
from (irb):1

这是我的 gem list

*** LOCAL GEMS ***

actionmailer (2.3.14)
actionpack (2.3.14)
activemdb (0.2.2)
activerecord (2.3.14)
activeresource (2.3.14)
activesupport (2.3.14)
bundler (1.1.3)
coderay (1.0.7)
edavis10-object_daddy (0.4.3)
fastercsv (1.5.5)
hoe (3.0.8)
i18n (0.4.2)
json (1.7.5)
metaclass (0.0.1)
mocha (0.12.3)
mysql (2.8.1)
net-ldap (0.3.1)
rack (1.1.3)
rails (2.3.14)
rake (0.9.2.2)
rdoc (3.12)
rmagick (2.13.1)
ruby-openid (2.1.8)
rubygems-bundler (0.2.8)
rvm (1.11.3.3)
shoulda (2.10.3)
sqlite3 (1.3.6)
tzinfo (0.3.33)

这里是我 Access activemdb 的代码

class Beacon < ActiveMDB::Base
set_mdb_file 'att2000.mdb'
end

最佳答案

这是因为由于某些原因,虽然 gem 本身称为“activemdb”,但 gem 中的文件是“active_mdb.rb”。这可以防止 Rails 自动要求它。

尝试将其添加到您的 Gemfile 中:

gem 'activemdb', :require => 'active_mdb'

那么它应该可以工作了。

关于mysql - activemdb基类不能继承?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12457163/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com