Ответ 1
Я столкнулся с той же проблемой вчера. По-видимому, "устаревший" - это драгоценный камень, поэтому вы хотите запустить "gem install deprecated" для захвата и установки последней версии. Удачи.
Хорошо, я выполнил шаги по настройке ruby и rails на моей машине Vista, и у меня возникла проблема с подключением к базе данных.
database.yml
development:
adapter: sqlserver
database: APPS_SETUP
Host: WindowsVT06\SQLEXPRESS
Username: se
Password: paswd
Запустите rake db:migrate
из каталога myapp
----------
rake aborted!
no such file to load -- deprecated
У меня установлен dbi 0.4.0 и создал папку ADO в
C:\Ruby\lib\ruby\site_ruby\1.8\DBD\ADO
Я получил ado.rb из dbi 0.2.2
Что еще я должен искать, чтобы исправить проблему, связанную с базой данных? Пожалуйста, не говорите мне использовать MySql или Sqlite или Postgres.
**** **** UPDATE
Я установил gemer-server-sqlserver-адаптер из -source = http://gems.rubyonrails.org
Все еще не работает.
Я проверил, что могу подключиться к базе данных, войдя в SQL Management Studio с учетными данными.
rake db: migrate --trace
PS C:\Inetpub\wwwroot\myapp> rake db:migrate --trace
(in C:/Inetpub/wwwroot/myapp)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
no such file to load -- deprecated
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:510:in `require'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:355:in `new_constants_in'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:510:in `require'
C:/Ruby/lib/ruby/site_ruby/1.8/dbi.rb:48
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:510:in `require'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:355:in `new_constants_in'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:510:in `require'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/core_ext/kernel/requires.rb:7:in `require_library_
or_gem'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnin
gs'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/core_ext/kernel/requires.rb:5:in `require_library_
or_gem'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-1.0.0.9250/lib/active_record/connection_adapters/sqlserver
_adapter.rb:29:in `sqlserver_connection'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/abstract/connection_specificatio
n.rb:292:in `send'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/abstract/connection_specificatio
n.rb:292:in `connection='
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/abstract/connection_specificatio
n.rb:260:in `retrieve_connection'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/abstract/connection_specificatio
n.rb:78:in `connection'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/migration.rb:408:in `initialize'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/migration.rb:373:in `new'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/migration.rb:373:in `up'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/migration.rb:356:in `migrate'
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.1.1/lib/tasks/databases.rake:99
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:621:in `call'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:621:in `execute'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:616:in `each'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:616:in `execute'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:582:in `invoke_with_call_chain'
C:/Ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:575:in `invoke_with_call_chain'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:568:in `invoke'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2031:in `invoke_task'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2009:in `top_level'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2009:in `each'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2009:in `top_level'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2048:in `standard_exception_handling'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2003:in `top_level'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:1982:in `run'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2048:in `standard_exception_handling'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:1979:in `run'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/bin/rake:31
C:/Ruby/bin/rake:19:in `load'
C:/Ruby/bin/rake:19
PS C:\Inetpub\wwwroot\myapp>
Я столкнулся с той же проблемой вчера. По-видимому, "устаревший" - это драгоценный камень, поэтому вы хотите запустить "gem install deprecated" для захвата и установки последней версии. Удачи.
Я использовал источник данных ODBC и адаптер SQL Server в Windows Server 2008 для SQL Server 2000, работающий на удаленном экземпляре.
Установить адаптер SQL Server
gem.bat install activerecord-sqlserver-adapter
Successfully installed deprecated-2.0.1
Successfully installed dbi-0.4.1
Successfully installed dbd-odbc-0.2.4
Successfully installed activerecord-sqlserver-adapter-2.2.22
4 gems installed
Создать источник данных ODBC
Настройка database.yml
development:
adapter: sqlserver
mode: odbc
dsn: rails_development
username: sa
password: 12345
YMMV
Несколько полезных ссылок:
Установлен ли адаптер SQL Server?
gem install activerecord-sqlserver-adapter --source=http://gems.rubyonrails.org
Если вы работаете на 64-битной машине, есть две программы администратора ODBC, одна для 32 бит и одна для 64 бит. activeerecord-sqlserver-адаптер ищет DSN, настроенные с 32-разрядной версией.
Правильная ссылка http://rubyrailsandwindows.blogspot.com/2008/03/rails-2-and-sql-server-2008-on-windows_24.html
Я тоже столкнулся с этой проблемой. Существует еще одна работа. Вы можете создать DSN для приложения db из панели управления → admin tools- > Odbc. Файл Database.yml должен выглядеть следующим образом:
adapter: sqlserver
mode: odbc
dsn: DSN_NAME
host: localhost
database: App_development
username: uname
password: password
Я пробовал использовать устаревший драгоценный камень, не имел большого смысла. Я также попытался установить адаптер ADO, который оказался бесполезным.