我正在与Rails项目的设计师合作,因此我们必须使用Rails堆栈设置他的mac机器进行开发。我目前有一个OS X Lion Mac,并且没有任何问题安装Rails(使用标准RVM,Homebrew,git,Ruby 1.9.2和gem set)。当我尝试在他的Leopard(10.5.8)机器中遵循相同的程序时,结果并不完美。
当我尝试运行rails server命令时,在安装了Rails 3.1和sqlite-ruby gem之后,我得到以下输出:
=> Booting WEBrick
=> Rails 3.1.1 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/active_record/connection_adapters/sqlite_adapter.rb:229:in `block in exec_query': NoMethodError: undefined method `to_a' for #<SQLite3::Statement:0x57f4658>: SELECT name (ActiveRecord::StatementInvalid)
FROM sqlite_master
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract_adapter.rb:244:in `block in log'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract_adapter.rb:239:in `log'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/active_record/connection_adapters/sqlite_adapter.rb:223:in `exec_query'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/active_record/connection_adapters/sqlite_adapter.rb:315:in `tables'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:25:in `table_exists?'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/active_record/attribute_methods/primary_key.rb:41:in `get_primary_key'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/active_record/attribute_methods/primary_key.rb:25:in `reset_primary_key'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/active_record/attribute_methods/primary_key.rb:16:in `primary_key'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.3.4/lib/active_admin/resource.rb:151:in `default_options'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.3.4/lib/active_admin/resource.rb:59:in `initialize'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.3.4/lib/active_admin/resource/action_items.rb:11:in `initialize'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.3.4/lib/active_admin/resource/sidebars.rb:9:in `initialize'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.3.4/lib/active_admin/namespace.rb:118:in `new'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.3.4/lib/active_admin/namespace.rb:118:in `find_or_build_resource'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.3.4/lib/active_admin/namespace.rb:46:in `register'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.3.4/lib/active_admin/comments.rb:23:in `block in <top (required)>'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.3.4/lib/active_admin/event.rb:23:in `call'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.3.4/lib/active_admin/event.rb:23:in `block in dispatch'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.3.4/lib/active_admin/event.rb:22:in `each'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.3.4/lib/active_admin/event.rb:22:in `dispatch'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.3.4/lib/active_admin/application.rb:95:in `find_or_create_namespace'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.3.4/lib/active_admin/application.rb:86:in `register'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.3.4/lib/active_admin.rb:60:in `register'
from /Users/developer/proyectos/lacorona/app/admin/events.rb:1:in `<top (required)>'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `load'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `block in load'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `block in load_dependency'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `load_dependency'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `load'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.3.4/lib/active_admin/application.rb:132:in `block in load!'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.3.4/lib/active_admin/application.rb:132:in `each'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.3.4/lib/active_admin/application.rb:132:in `load!'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.3.4/lib/active_admin/application.rb:155:in `routes'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.3.4/lib/active_admin.rb:63:in `routes'
from /Users/developer/proyectos/lacorona/config/routes.rb:6:in `block in <top (required)>'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.1/lib/action_dispatch/routing/route_set.rb:258:in `instance_exec'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.1/lib/action_dispatch/routing/route_set.rb:258:in `eval_block'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.1/lib/action_dispatch/routing/route_set.rb:235:in `draw'
from /Users/developer/proyectos/lacorona/config/routes.rb:1:in `<top (required)>'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `load'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `block in load'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `block in load_dependency'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `load_dependency'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `load'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:29:in `block in load_paths'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:29:in `each'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:29:in `load_paths'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:13:in `reload!'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application.rb:87:in `reload_routes!'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.3.4/lib/active_admin/reloader.rb:34:in `reload!'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.3.4/lib/active_admin/reloader.rb:28:in `block in initialize'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/file_update_checker.rb:32:in `call'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/file_update_checker.rb:32:in `execute_if_updated'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.3.4/lib/active_admin/reloader.rb:45:in `block in attach!'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/callbacks.rb:404:in `_run_prepare_callbacks'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.1/lib/action_dispatch/middleware/reloader.rb:46:in `prepare!'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/finisher.rb:41:in `block in <module:Finisher>'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/initializable.rb:30:in `run'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/initializable.rb:54:in `each'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application.rb:96:in `initialize!'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/developer/proyectos/lacorona/config/environment.rb:5:in `<top (required)>'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `block in require'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `block in load_dependency'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `load_dependency'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
from /Users/developer/proyectos/lacorona/config.ru:4:in `block in <main>'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/builder.rb:51:in `instance_eval'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/builder.rb:51:in `initialize'
from /Users/developer/proyectos/lacorona/config.ru:1:in `new'
from /Users/developer/proyectos/lacorona/config.ru:1:in `<main>'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/builder.rb:40:in `eval'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/builder.rb:40:in `parse_file'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/server.rb:200:in `app'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands/server.rb:46:in `app'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/server.rb:301:in `wrapped_app'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/server.rb:252:in `start'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands/server.rb:70:in `start'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands.rb:54:in `block in <top (required)>'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands.rb:49:in `tap'
from /Users/developer/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands.rb:49:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
修改的
运行rake db:migrate
会返回相同的错误:
NoMethodError: undefined method `to_a' for #<SQLite3::Statement:0x11a0e4>: SELECT name
FROM sqlite_master
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
有没有人遇到过类似的问题?
答案 0 :(得分:2)
我有这个问题......
我认为这是一个不正确的宝石。
如果没有这样做,请尝试这样做:
gem 'sqlite3-ruby', '>= 1.3.1', :require => 'sqlite3'
然后$ bundle install
答案 1 :(得分:0)
好吧,我们终于切换到了MySQL来避免这个问题。