作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试通过 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/
我是一名优秀的程序员,十分优秀!