2012-12-03 19 views
0

我安裝了activerecord-sqlserver-adapter,使它出現在我的本地gem中。 運行命令使用activerecord-sqlserver-adapter時出錯

rails generate scaffold Tablename fieldname:fieldtype 

返回錯誤(如下)。我安裝了rails 1.9.2。任何指導或協助將不勝感激。由於

C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-.2.8/lib/active_support/dependencies.rb:251:in `require': Please install the sqlserver adapter: `gem install activerecord-sqlserver-adapter` (no such file to load -- active_record/connection_adapters/sqlserver_adapter) (LoadError) 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-.2.8/lib/active_support/dependencies.rb:251:in `block in require' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-.2.8/lib/active_support/dependencies.rb:236:in `load_dependency' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-.2.8/lib/active_support/dependencies.rb:251:in `require' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:50:in `resolve_hash_connection' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:41:in `resolve_string_connection' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:25:in `spec' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:129:in `establish_connection' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/railtie.rb:82:in `block (2 levels) in <class:Railtie>' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-.2.8/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-.2.8/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-.2.8/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-.2.8/lib/active_support/lazy_load_hooks.rb:42:in `each' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/base.rb:721:in `<top (required)>' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/generators/named_base.rb:166:in `pluralize_table_names?' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/generators/named_base.rb:114:in `table_name' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.2.8/lib/rails/generators/active_record/model/model_generator.rb:17:in `create_migration_file' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/task.rb:27:in `run' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:120:in `invoke_task' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `block in invoke_all' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `each' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `map' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `invoke_all' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/group.rb:238:in `dispatch' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:109:in `invoke' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/group.rb:281:in `block in _invoke_for_class_method' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/shell.rb:74:in `with_padding' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/group.rb:270:in `_invoke_for_class_method' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/group.rb:150:in `_invoke_from_option_orm' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/task.rb:27:in `run' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:120:in `invoke_task' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `block in invoke_all' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `each' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `map' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `invoke_all' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/group.rb:238:in `dispatch' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/base.rb:425:in `start' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/generators.rb:171:in `invoke' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-.2.8/lib/rails/commands/generate.rb:12:in `<top (required)>' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-.2.8/lib/active_support/dependencies.rb:251:in `require' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-.2.8/lib/active_support/dependencies.rb:251:in `block in require' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-.2.8/lib/active_support/dependencies.rb:236:in `load_dependency' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-.2.8/lib/active_support/dependencies.rb:251:in `require' 
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/commands.rb:29:in `<top (required)>' 
    from script/rails:6:in `require' 
    from script/rails:6:in `<main>' 

*當地的寶石*

actionmailer (3.2.8, 3.1.0, 2.2.3) 
actionpack (3.2.8, 3.1.0, 2.2.3) 
activemodel (3.2.9, 3.2.8, 3.1.0) 
activerecord (3.2.8, 3.1.0) 
activerecord-sqlserver-adapter (3.2.10, 3.1.7) 
activeresource (3.2.8, 3.1.0) 
activesupport (3.2.9, 3.2.8, 3.1.0, 2.2.3) 
ansi (1.4.3, 1.3.0) 
archive-tar-minitar (0.5.2) 
arel (3.0.2, 2.2.1) 
bcrypt-ruby (3.0.1 x86-mingw32) 
builder (3.0.4, 3.0.0) 
bundler (1.2.1) 
coffee-rails (3.2.2, 3.1.1) 
coffee-script (2.2.0) 
coffee-script-source (1.4.0, 1.1.2) 
columnize (0.3.6) 
erubis (2.7.0) 
execjs (1.4.0, 1.2.9) 
ffi (1.1.5) 
hike (1.2.1) 
i18n (0.6.1, 0.6.0) 
journey (1.0.4) 
jquery-rails (2.1.4, 2.1.3, 1.0.14) 
json (1.7.5, 1.6.1) 
linecache19 (0.5.12) 
mail (2.4.4, 2.3.0) 
mime-types (1.19, 1.16) 
minitest (4.1.0, 3.5.0, 3.4.0, 1.6.0) 
multi_json (1.4.0, 1.3.7, 1.3.6, 1.0.3) 
nokogiri (1.5.5 x86-mingw32) 
polyglot (0.3.3, 0.3.2) 
rack (1.4.1, 1.3.4) 
rack-cache (1.2, 1.0.3) 
rack-mount (0.8.3) 
rack-ssl (1.3.2) 
rack-test (0.6.2, 0.6.1) 
rails (3.2.8, 3.1.0) 
railties (3.2.8, 3.1.0) 
rake (10.0.2, 10.0.1, 0.9.2.2, 0.9.2, 0.8.7) 
rdiscount (1.6.8) 
rdoc (3.12, 3.10, 2.5.8) 
ruby-debug-base19 (0.11.25) 
ruby-debug-ide (0.4.16) 
ruby-debug19 (0.11.6) 
ruby_core_source (0.1.5) 
sass (3.2.3, 3.1.10) 
sass-rails (3.2.5, 3.1.4) 
sprockets (2.1.3, 2.0.2) 
sqlite3 (1.3.6 x86-mingw32, 1.3.4 x86-mingw32) 
sqlite3-ruby (1.3.3) 
thor (0.16.0, 0.14.6) 
tilt (1.3.3) 
tiny_tds (0.5.1 x86-mingw32) 
tmail (1.2.7.1) 
treetop (1.4.12, 1.4.11, 1.4.10) 
turn (0.9.6, 0.8.3) 
tzinfo (0.3.35, 0.3.30) 
uglifier (1.3.0, 1.0.3) 
win32-sound (0.5.0) 
+0

您是否嘗試過使用bundle bundle生成scaffold tablename fieldname:fieldtype? –

+0

我現在有。同樣的錯誤。必須與寶石版本/位置有關,但我無法看到哪裏/哪裏出錯。 :-( – cymorg

回答

0

終於解決了這一點。爲了解決我卸載了activerecord-sqlserver-adapter的兩個衝突版本,安裝了ruby-odbc gem,安裝了activerecord-sqlserver-adapter,調整了gemfile以反映正確的版本,然後運行了bundle update,然後綁定安裝,最後rails生成scaffold。命令。

0

是創業板在上市Gemfile

添加到您的Gemfile(gem manual

gem 'tiny_tds' 
gem 'activerecord-sqlserver-adapter', '~> 3.1.0' 

,並再次運行bundle install

+0

我將上面的代碼添加到站點gemfile並運行bundle install。一些改進,但主要錯誤仍然存​​在 - 看起來rails無法找到activerecod-sqlserver-adapter – cymorg